• Nirav_Shah
  • NEWBIE
  • 39 Points
  • Member since 2015
  • 7x Salesforce Certified Professional


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 13
    Replies
Hi Folks,

I have created one controller in which I am getting the API response in JSON format. The JSON format is as following
{
    "APIResponse": {
        "APIResult": {
            "row": [
                {
                    "SR_NBR": "1-233391976021",
                    "SR_CREATED": "2018-04-26T13:44:25.000Z",
                    "SR_TYPE": "Repair",
                    .
					.
					.
					.
					.
					.
					.
                }
            ]
        }
    }
}
Now, my requirement is I need to show this response in proper PDF format in Visualforce page.
How to achieve this scenario?

Thanks
Hi Folks,

Following is my code
List <AccountTeamMember> teamMemberList = new List <AccountTeamMember>();
            
            Set <String> teamMemberRole = new Set <String>();
                
                if(accountDetail.Ultimate_Parent__c && accountDetail.Parent__c){
                    teamMemberList = createTeamMemberList(accountDetail.Id, teamMemberRole);
                }
                else if(accountDetail.Parent__c){
                    teamMemberList = createTeamMemberList(accountDetail.Id, teamMemberRole);
                    for (AccountTeamMember tm : teamMemberList){
                        teamMemberRole.add(tm.TeamMemberRole);
					}
                    if (!teamMemberRole.isEmpty() && teamMemberRole.size() != 4){
                        teamMemberList.addAll(createTeamMemberList(accountDetail.ParentId, teamMemberRole));
					}
                }
                else{
                    teamMemberList = createTeamMemberList(accountDetail.Id, teamMemberRole);
                    for (AccountTeamMember tm : teamMemberList){
                    	teamMemberRole.add(tm.TeamMemberRole);
					}
                    if (!teamMemberRole.isEmpty() && teamMemberRole.size() != 4){
                        for (AccountTeamMember tm : createTeamMemberList(accountDetail.ParentId, teamMemberRole)){
                            teamMemberRole.add(tm.TeamMemberRole);
                            teamMemberList.add(tm);
						}
                    }
                }
                
    // Create Account Team Member List
    public static List<AccountTeamMember> createTeamMemberList (Id accId, Set <String> teamMemberRole){
        Final List<String> roleList = Label.CCP_TeamMemberRole.split(',');
        return [SELECT User.Name, User.Email, user.Phone, TeamMemberRole, user.FullPhotoUrl, Account.Name, 
                FROM AccountTeamMember WHERE AccountId =: accId 
                AND TeamMemberRole NOT IN: (teamMemberRole) AND TeamMemberRole IN: (roleList)
                AND User.isActive = true];
    }
}

As you can see I have to use multiple iterations(For Loops) just to add Team Member Role to set of String, can you guys please suggest me some better way of doing this

Thanks
I have created API (an apex class with restful service - HttpGet) to expose the User Details to an external system in which I am sending all the details regarding users like Name, Email, Language etc. Now I want to send the Profile Photo also, I know we can query and get SmallPhotoUrl and FullPhotoUrl but I don't want URL. I want the actual image in Base64 format.
Any Ideas for this?
Hi Folks,

I am trying to create the API which can fetch the data from Salesforce and send it to an external system. For that, I am using REST web services HttpGet.
Below is the code I am trying to write.
@RestResource(urlMapping='/api/*')
global with sharing class DetailsController{
   
    @HttpGet
    global static List<Wrapper1> getDetails() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        
        string GO, ID;
        
		if(!string.isEmpty(req.params.get('GO'))){
			GON = req.params.get('GO');
		}
		else{
			throw new Utility.applicationException('GO Cannot be null');
		}
		
		if(!string.isEmpty(req.params.get('ID'))){
			UCMID = req.params.get('ID');
		}
		else{
			ID = '';
		}
        
        List<Wrapper1> Details = fetchDetails(GO, ID);
        return Details;
    }
The Wrapper1 hear is the Wrapper class which includes another wrapper class Wrapper2 in it.

Wrapper1
global class Wrapper1 {
    @AuraEnabled
    public string GO;
    @AuraEnabled
    public string Name;
    @AuraEnabled
    public string Address;
    @AuraEnabled
    public List<Wrapper2> Fsets;
    public class OrderTrackingDetail{
        @AuraEnabled public string Carrier=System.label.CCP_NotAvailableValue;
        @AuraEnabled public string TrackingID=System.label.CCP_NotAvailableValue;
        @AuraEnabled public string fSetNum;
        @AuraEnabled public string trackingURL;
    }
}
Wrapper2
public class Wrapper2 implements Comparable {
	
    public string addressCity;
    @AuraEnabled
    public string addressLine1;
    @AuraEnabled
    public string addressLine2;
    @AuraEnabled
    public string addressLise3;
    public string addressLine4;
    public string addressState;
    public string addressZip;
    public string Name;
    public string Country;
    @AuraEnabled
    public List<Object> object1 = new List<Object>();
    @AuraEnabled
    public List<Object> object2 = new List<Object>();
    public Integer compareTo(Object objToCompare) {
        integer val1 = integer.valueOf(//something);
        integer val2 = integer.valueOf(((Wrapper2)objToCompare).//something);
        if (val1 == val2) 
            return 0;
        if (val1 > val2) 
            return 1;
        return -1;
    }
}

When I am trying to write the gate method I am getting the below error.
Invalid type for Http* method: LIST.Wrapper1.LIST.Wrapper2.LIST.Object
How to solve this error.? Please help

Thanks
Nirav
 
My issue seems to be very strange. I have created this process and when I test it, it is updating the sales price to deposit amount as said in the requirement. But when the chellenge is checked it gives me error message:
Challenge Not yet complete... here's what's wrong: 
The Fulfillment Cancellation Automation process does not appear to be working properly. Make sure that a cancelled Fulfillment updates the Adventure Package correctly.


Chose the fullfillment object
have proper conditions:
User-added image

and update the adventure package
User-added image

I tested it and it seems to be updating the sales price to the diposit amount correctly:
User-added image

but still on checking Chellenge I get the error:
User-added image

completedly stumped!!! please let me know if anybody faced the same issue. any help.
 
 "Locked filter" related error during check challenge of Report dashboards super badge. Attached screenshot please replay.
User-added image
Hi All,
I am in the "Reports & Dashboards Specialist" Superbadge (Challenge 2 : Create sales dashboards in Salesforce Classic).
I am getting the error 

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: NNTFJFJL
I don't know what is the error but I am using the new Developer Org to complete the SuperbadgeUser-added image

Please Advise
Thanks
Nirav
I am trying to add custom tile on PDF page. Its always showing VF page API name in title. I tried <head><title>example</title></head> but no success.

<apex:page showHeader="false" renderAs="pdf">
<head>
<title> Example!!</title>
</head>
TEST
</apex:page>


User-added image


Thanks!

I am  trying to upsert a salesforce by web service.

but I get the following error

UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService

 

Any ideas?

 

Detail Below

 
【Binding Operation Property】
<implementation xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" type="Invoke">
  <serverUri>※I wrote return message by login </serverUri>
  <soapaction>""</soapaction>
  <authenticationType>Anonymous</authenticationType>
  <userId>※ Iwrote userId</userId>
  <password>※ Iwrote password</password>
  <host>×.×.×.×</host>
  <port>80</port>
  <charset>UTF-8</charset>
</implementation>


【Soap Request】

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP:Header>
    <DebuggingHeader xmlns="urn:enterprise.soap.sforce.com">
      <debugLevel>none</debugLevel>
    </DebuggingHeader>
    <DisableFeedTrackingHeader xmlns="urn:enterprise.soap.sforce.com">
      <disableFeedTracking>0</disableFeedTracking>
    </DisableFeedTrackingHeader>
    <PackageVersionHeader xmlns="urn:enterprise.soap.sforce.com">
      <packageVersions>
        <majorNumber>0</majorNumber>
        <minorNumber>0</minorNumber>
        <namespace></namespace>
      </packageVersions>
    </PackageVersionHeader>
    <AssignmentRuleHeader xmlns="urn:enterprise.soap.sforce.com">
      <assignmentRuleId></assignmentRuleId>
      <useDefaultRule>0</useDefaultRule>
    </AssignmentRuleHeader>
    <EmailHeader xmlns="urn:enterprise.soap.sforce.com">
      <triggerAutoResponseEmail>0</triggerAutoResponseEmail>
      <triggerOtherEmail>0</triggerOtherEmail>
      <triggerUserEmail>0</triggerUserEmail>
    </EmailHeader>
    <SessionHeader xmlns="urn:enterprise.soap.sforce.com">
      <sessionId>※I wrote return message by login </sessionId>
    </SessionHeader>
    <AllOrNoneHeader xmlns="urn:enterprise.soap.sforce.com">
      <allOrNone>1</allOrNone>
    </AllOrNoneHeader>
    <AllowFieldTruncationHeader xmlns="urn:enterprise.soap.sforce.com">
      <allowFieldTruncation>1</allowFieldTruncation>
    </AllowFieldTruncationHeader>
    <MruHeader xmlns="urn:enterprise.soap.sforce.com">
      <updateMru>false</updateMru>
    </MruHeader>
  </SOAP:Header>
  <SOAP:Body>
    <upsert xmlns="urn:enterprise.soap.sforce.com">
      <externalIDFieldName>Id</externalIDFieldName>
      <sObjects xsi:type="Account">
  <Fax>03-1111-1111</Fax>
  <Name>AAA</Name>
  <Phone></Phone>
  <Id></Id>
      </sObjects>
    </upsert>
  </SOAP:Body>
</SOAP:Envelope>

 

 

【Response Message】

 <data>
 <SOAP:Fault xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" >
<faultcode xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" >ns0:Server</faultcode>
<faultstring xml:lang="en-US" >UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService.</faultstring>
<faultactor>urn:enterprise.soap.sforce.com</faultactor>
 <detail>
 <cordys:FaultDetails xmlns:cordys="http://schemas.cordys.com/General/1.0/" >
 <cordys:LocalizableMessage xmlns:cordys="http://schemas.cordys.com/General/1.0/" >
<cordys:MessageCode xmlns:cordys="http://schemas.cordys.com/General/1.0/" >Cordys.UDDI.Messages.generalException</cordys:MessageCode>
<cordys:Insertion xmlns:cordys="http://schemas.cordys.com/General/1.0/" >UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService</cordys:Insertion>
</cordys:LocalizableMessage>
</cordys:FaultDetails>
<externalFaultCode>UNKNOWN_EXCEPTION</externalFaultCode>
 <sf:UnexpectedErrorFault xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xsi:type="sf:UnexpectedErrorFault" >
<sf:exceptionCode>UNKNOWN_EXCEPTION</sf:exceptionCode>
<sf:exceptionMessage>Destination URL not reset. The URL returned from login must be set in the SforceService</sf:exceptionMessage>
</sf:UnexpectedErrorFault>
</detail>
</SOAP:Fault>
</data>
 
 
Thanks.