• D Vel
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 5
    Replies
I am trying to add the HelpText in to the VF Page and I tried few options like below and none of them is working for me. Added the HelpText in the <apex:pageblockSectionItem>
<apex:pageblockSectionItem >
   <apex:outputPanel >
      <div class="ListLevel02">
         <apex:outputLabel value="Type 1" HelpText = "Test"></apex:outputLabel>
      </div> 
   </apex:outputPanel>
   <apex:inputcheckbox value="{!conRec.Type_I__c}" styleClass="ListLevel02"></apex:inputcheckbox>
  </apex:pageblockSectionItem>
User-added image
HelpText is not enabled and cant click on them. I tried to have the HelpText added at the field
User-added image
And tried using them like
<apex:pageblockSectionItem HelpText = '{!$ObjectType.Contact.Fields.Type_I__c.inlineHelpText}'>


Even this has the same behaviour. Can anyone say what am I missing here
  • July 13, 2020
  • Like
  • 0
I have input Checkboxes in the VF page on the Lead record with the requirement that if one of the field is checked the other should be checked as well when the save button is clicked on the VF Page and it is the same when being unchecked
User-added imageThere is this 3rd field on the Lead record which dont exists on the VF Page but needs to updated depending on the above two fields
User-added imagebelow is what I tried
VF Page
<apex:pageblockSectionItem >
                        <apex:outputPanel >
                            <div class="ListLevel01">
                                <apex:outputLabel value="Type 1"></apex:outputLabel>
                            </div> 
                        </apex:outputPanel>
                        <apex:inputcheckbox value="{!leadRec.Type_I_AI__c}" styleClass="ListLevel01">
                            <apex:actionSupport event="onchange" reRender="form" status="status"/>
                        </apex:inputcheckbox>
                    </apex:pageblockSectionItem>
                    <apex:pageblockSectionItem >
                        <apex:outputPanel >
                            <div class="ListLevel01">
                                <apex:outputLabel value="Type 1"></apex:outputLabel>
                            </div> 
                        </apex:outputPanel>
                        <apex:inputcheckbox value="{!leadRec.Type_I_DOM__c}" styleClass="ListLevel01">
                            <apex:actionSupport event="onchange" reRender="form" status="status"/>
                        </apex:inputcheckbox>
                    </apex:pageblockSectionItem>

             ..................
  </apex:pageblock>    
  <apex:commandButton value="Save" style="margin-left:900px;" action="{!finalUpdates}" rerender="form"  oncomplete="RefreshPrimaryTab('{!Lead.id}'); return true;" />
 </apex:form>
The finalUpdates updates the Lead record which in turn fires the trigger like below
set<Id> leadIds = new set<Id>();
    for(Lead l : Trigger.new){
        leadIds.add(l.Id);
    }
    if(!leadIds.isempty() && checkRecursiveTrigger.ranOnce == false)
       LeadTriggerHandler.updateAOI(trigger.newMap, trigger.oldMap);
}
Apex Class
Public class LeadTriggerHandler{
 public static void updateAOI(Map<Id, Lead> newLeads, Map<Id, Lead> oldLeads){
    Set<Id> resultIds = (new Map<Id,Lead>(newLeads)).keySet();
           List<Lead> Leadlist = [Select Id, Type_I__c,Type_I_AI__c,Type_I_DOM__c
                               from Lead WHERE Id IN: resultIds];
        List<Lead> updateList = new List<Lead>();
        set<id> LeadIds= new set<Id>();
        for(Lead l : Leadlist){
                     if(   newLeads.get(l.Id).Type_I_DOM__c == true || newLeads.get(l.Id).Type_I_AI__c  == true)
            {
                l.Type_I_DOM__c = true;
                l.Type_I_AI__c  = true;
                l.Type_I__c = true;
                if(!leadIds.contains(l.Id)){
                    leadIds.add(l.Id);
                    updateList.add(l);
                }                
            }
            
            if(newLeads.get(l.Id).Type_I_DOM__c == false || newLeads.get(l.Id).Type_I_AI__c  == false)
            {
               l.Type_I_DOM__c = false;
                l.Type_I_AI__c  = false;
                l.Type_I__c = false;
                if(!leadIds.contains(l.Id)){
                    leadIds.add(l.Id);
                    updateList.add(l);
                }                
            }
         .............
But this doesnt work as expected, it executes both the if condition if condition if I just click on just one field and not even touch the other field in the end even if 1 field is selected I see false on all the three fields. I now understand my approach here is wrong but not sure how to handle it. Any help is greatly appreciated
  • July 13, 2020
  • Like
  • 0
I am trying to get all the validation error message from my apex class in to the lightning component. Earlier I was using the DMLException and only one 1 validation error was captured. So I tried to use the Database.SaveResultlike below is my apex Class
@AuraEnabled
public static String passCase(String caseId){
    List<Case> case_recs = [SELECT id,_Case_Flow__c,Status from Case WHERE Id = :caseId];
    String msg = '';
    for (Case rec : case_recs)
    {
        rec.Status = 'Transferred';
        rec.Route_Case_Flow_Executing__c = true;
        Database.SaveResult saves = Database.update(rec, false);

            if(!saves.isSuccess()) {
                msg = 'Error '+ saves.getErrors()[0].getMessage();
            }
           else {
               msg = 'Successfully Updated!';
           }
           return msg; 
        }          
    return msg;
}
And my lightning component looks like below
passCaseToCS_helper : function(c,e,h) {
    var set_action1 = c.get("c.passCase");
    set_action1.setParams({caseId: c.get('v.recordId')});
    set_action1.setCallback(this, function(result)
    {
        var resultFormApex = result.getReturnValue();
        if (result.getState() === 'SUCCESS')
            {               
                var toastEvent = $A.get("e.force:showToast");
                toastEvent.setParams({
                    message: resultFormApex ,
                    type: 'success',
                    mode: 'pester'
                });
                toastEvent.fire(); 
            }                
            else if(result.getState() === 'ERROR')
            {
                $A.get("e.force:showToast")
                        .setParams({
                            type: 'error',
                            mode: 'pester',
                            message: resultFormApex  }).fire();  
           }

        $A.get("e.force:refreshView").fire();
    });
    $A.enqueueAction(set_action1);       
}
When the record successfully gets updated with no Validation error I can see the Successfully Updated!in the toast for the records with Validation error I cannot see anything in the Toast. I tried to put a debug log to show what msg when the record update fails with Validation error I dont see anything on the logs either. I am not sure what I am missing here. Any help is greatly appreciated
 
  • April 10, 2020
  • Like
  • 0
I am trying to call the lightning Components from the Quick Action to change the status of Case to Closed on click of a button.
Components
<aura:component implements="force:hasRecordId,force:lightningQuickActionWithoutHeader">
  <aura:attribute name="record" type="Case" default="{ 'sobjectType': 'Case' }" />
  <aura:attribute name="complete" type="Boolean" default="false" />
  <force:recordData recordId="{!v.recordId}"
                    fields="['CaseNumber','Status']"
                    targetFields="{!v.record}"
                    aura:id="recordData"
                    recordUpdated="{!c.recordLoaded}" />
</aura:component>
Controller 
({ 
  recordLoaded: function(component, event, helper) {
    var caseRecord = component.get("v.record"),
      recordData = component.find("recordData");

      caseRecord.Status = 'Closed';

      if(!component.get("v.complete")) { // Avoid infinite loop
      component.set("v.complete", true);
      component.set("v.record", caseRecord);
      recordData.saveRecord($A.getCallback(function(result) {
        if(result.state === "SUCCESS" || result.state === "DRAFT") {
          $A.get("e.force:closeQuickAction").fire();
          $A.get("e.force:refreshView").fire();
        } else { /* show an error here */ }
      }));
  }
  }})
But when I click on the Quick Action it throws error like
User-added imageNot sure what I am missing here, any help is greatly appreciated

 
  • April 02, 2020
  • Like
  • 0
I have an auto launched flow in lightning that updates the Status of the Case to be closed when the button is clicked. The flow is like below 
User-added image
I am calling the flow through the Detail Page Button using the URL like
/flow/Close_Case_Autolaunched?recordId={!Case.Id}&retURL={!Case.Id}
With the return URL set after the flow completed it does return back to the Page but the page is not refreshed it just shows old status and when manually do a refresh it shows the Closed status. The flow does update the record but but the page is not being refreshed. How can we handle this
  • April 02, 2020
  • Like
  • 0
I am trying to understand how to set up the Named Credentials & OAuth Provider in Salesforce for calling the External REST API. Before setting this up I tested the call to the REST API through Apex like and it works fine
public class TestD365API {
    public final String clientId = 'xxxxxxx';
    public final String clientSecret = 'xxxxxx';
    public final String tenant_id = 'xxxx';
    public final String resource = 'https://abc.dynamics.com';

    public String getD365Customer(){             
        String reqbody = 'grant_type=client_credentials&client_id='+clientId+'&client_secret='+clientSecret+'&tenant_id='+tenant_id+'&resource='+resource;
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setBody(reqbody);
        req.setMethod('POST');
        req.setEndpoint('https://login.microsoftonline.com/tenant/oauth2/token');
        HttpResponse res = h.send(req);
        deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.class);
        String atoken = resp1.access_token;
        System.debug('Access Token=========' + atoken);

        Http http1 = new Http();
        HttpRequest req1 = new HttpRequest();
        req1.setEndpoint('https://abc.dynamics.com/data/Customers');
        req1.setMethod('GET');
        req1.setHeader('Authorization','Bearer '+atoken);
        HttpResponse res1 = http1.send(req1);
        System.debug('Response Body=========' + res1.getBody());
        return res1.getBody();                
    }  

    public class deserializeResponse
    {
        public String token_type;
        public String expires_in;
        public String ext_expires_in;
        public String expires_on;
        public String not_before;
        public String resource;
        public String access_token;
    }
}


I am passing 5 parameters in the request body to get the bearer token from the Authorization Provider and passing the token to the Rest endpoint and retrieving the data back.
Now trying to use Named credentials instead like below
User-added image
where in the Authorize URL I am giving as https://login.microsoftonline.com/tenant/oauth2/authorize?grant_type=client_credentials&tenant_id=xxxxxxxxxxx
And changed my Apex Code like
User-added imageI am not sure how to pass all the parameters (grant_type,tenant_id, client_id,client_secret,resource) to the Auth Provider and the bearer token to the Rest API endpoint through Named Credentials and get the response back. I am sure this is not the firewall/issue on Client end as I am able to test it through Apex Code. Any help is appreciated
  • February 14, 2020
  • Like
  • 0
I am trying to understand how to set up the Named Credentials & OAuth Provider in Salesforce for calling the External REST API. Before setting this up I tested the call to the REST API through Apex like and it works fine
public class TestD365API {
    public final String clientId = 'xxxxxxx';
    public final String clientSecret = 'xxxxxx';
    public final String tenant_id = 'xxxx';
    public final String resource = 'https://abc.dynamics.com';

    public String getD365Customer(){             
        String reqbody = 'grant_type=client_credentials&client_id='+clientId+'&client_secret='+clientSecret+'&tenant_id='+tenant_id+'&resource='+resource;
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setBody(reqbody);
        req.setMethod('POST');
        req.setEndpoint('https://login.microsoftonline.com/tenant/oauth2/token');
        HttpResponse res = h.send(req);
        deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.class);
        String atoken = resp1.access_token;
        System.debug('Access Token=========' + atoken);

        Http http1 = new Http();
        HttpRequest req1 = new HttpRequest();
        req1.setEndpoint('https://abc.dynamics.com/data/Customers');
        req1.setMethod('GET');
        req1.setHeader('Authorization','Bearer '+atoken);
        HttpResponse res1 = http1.send(req1);
        System.debug('Response Body=========' + res1.getBody());
        return res1.getBody();                
    }  

    public class deserializeResponse
    {
        public String token_type;
        public String expires_in;
        public String ext_expires_in;
        public String expires_on;
        public String not_before;
        public String resource;
        public String access_token;
    }
}
I am passing 5 parameters in the request body to get the bearer token from the Authorization Provider and passing the token to the Rest endpoint and retrieving the data back.
Now trying to use Named credentials instead like below
User-added imagewhere in the Authorize URL I am giving as https://login.microsoftonline.com/tenant/oauth2/authorize?grant_type=client_credentials&tenant_id=xxxxxxxxxxx
And changed my Apex Code like

User-added image​​​​​​​I am not sure how to pass all the parameters (grant_type,tenant_id, client_id,client_secret,resource) to the Auth Provider and the bearer token to the Rest API endpoint through Named Credentials and get the response back. I am sure this is not the firewall/issue on Client end as I am able to test it through Apex Code. Any help is appreciated.
 
  • February 14, 2020
  • Like
  • 0
I trying to test the Apex Call outs which uses the OAuth Authentication. I am not sure what I am missing here it throws error on the line HttpResponse res1 = http1.send(req1); like 

Line: 22, Column: 1
System.UnexpectedException: java.lang.IllegalArgumentException: invalid start or end
public class TestD365API {
    public final String clientId = 'xxxxxxxxxxxxx';
    public final String clientSecret = 'xxxxxxxx';
    
    public String getD365Customer(){             
        String reqbody = 'grant_type=client_credentials&client_id='+clientId+'&client_secret='+clientSecret;
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setBody(reqbody);
        req.setMethod('POST');
        req.setEndpoint('https://login.microsoftonline.com/tenant/oauth2/token');
        HttpResponse res = h.send(req);
        deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.class);
        String atoken = resp1.access_token;
        
        
        Http http1 = new Http();
        HttpRequest req1 = new HttpRequest();
        req1.setEndpoint('https://dev-xyz/data/Customers');
        req1.setMethod('GET');
        req1.setHeader('Authorization','Bearer '+atoken);
        HttpResponse res1 = http1.send(req1);
        System.debug('Response Body=========' + res1.getBody());
        return res1.getBody();   
    }  
    
    public class deserializeResponse
    {
        public String token_type;
        public String expires_in;
        public String ext_expires_in;
        public String expires_on;
        public String not_before;
        public String resource;
        public String access_token;
    }
}
Please help me fixing this issue.
  • February 13, 2020
  • Like
  • 0
I trying to test the Apex Call outs which uses the OAuth Authentication. I am not sure what I am missing here it throws error on the line HttpResponse res1 = http1.send(req1); like 

Line: 22, Column: 1
System.UnexpectedException: java.lang.IllegalArgumentException: invalid start or end
public class TestD365API {
    public final String clientId = 'xxxxxxxxxxxxx';
    public final String clientSecret = 'xxxxxxxx';
    
    public String getD365Customer(){             
        String reqbody = 'grant_type=client_credentials&client_id='+clientId+'&client_secret='+clientSecret;
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setBody(reqbody);
        req.setMethod('POST');
        req.setEndpoint('https://login.microsoftonline.com/tenant/oauth2/token');
        HttpResponse res = h.send(req);
        deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.class);
        String atoken = resp1.access_token;
        
        
        Http http1 = new Http();
        HttpRequest req1 = new HttpRequest();
        req1.setEndpoint('https://dev-xyz/data/Customers');
        req1.setMethod('GET');
        req1.setHeader('Authorization','Bearer '+atoken);
        HttpResponse res1 = http1.send(req1);
        System.debug('Response Body=========' + res1.getBody());
        return res1.getBody();   
    }  
    
    public class deserializeResponse
    {
        public String token_type;
        public String expires_in;
        public String ext_expires_in;
        public String expires_on;
        public String not_before;
        public String resource;
        public String access_token;
    }
}
Please help me fixing this issue.
  • February 13, 2020
  • Like
  • 1
Test Rest API from Salesforce using Named Credentials
I am trying to test the API Callouts from Salesforce using the Named Credentials. I have setup the Named Credentials and OAuth Providers and was able to quickly test the Authentication within Named Credentials
User-added image
I am trying to write the Apex Class to see if I can retrieve records from the Rest API I am not how to test Executing this Anonymously without calling from a button/VF Page
public with sharing class RetrieveD365Data {
    public RetrieveD365Data() {
              Http http = new Http();
              HttpRequest req = new HttpRequest();
              req.setEndpoint('callout:Dev_D365/data/Customers');
              req.setMethod('GET');
              req.setTimeout(30000);
              HttpResponse res = http.send(req);
              System.debug('Response Body===========' + res.getBody());
    }
}


Please help me with this as I am new to Salesforce
  • February 13, 2020
  • Like
  • 0
I am trying to test the API Callouts from Salesforce using the Named Credentials. I have setup the Named Credentials and OAuth Providers and was able to quickly test the Authentication within Named Credentials
User-added image
I am trying to write the Apex Class to see if I can retrieve records from the Rest API I am not how to test Executing this Anonymously without calling from a button/VF Page
public with sharing class RetrieveD365Data {
    public RetrieveD365Data() {
              Http http = new Http();
              HttpRequest req = new HttpRequest();
              req.setEndpoint('callout:Dev_D365/data/Customers');
              req.setMethod('GET');
              req.setTimeout(30000);
              HttpResponse res = http.send(req);
              System.debug('Response Body===========' + res.getBody());
    }
}
Please help me with this as I am new to Salesforce
  • February 13, 2020
  • Like
  • 0
I am new to Salesforce and I would like to get some expert advice on how I can expose the Sales force data as an Rest API so the external System can consume it. I was think if I can create a Apex Class like below
@RestResource(urlMapping='/GetAccounts/*')
global with sharing class GetAccounts {
    @HttpGet
    global static Account doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        Account result = [SELECT Id, Name FROM Account WHERE Id = :accountId];
        return result;
    }
}


And for the external user to consume the data I thought I can set up up a Connected App and provide them with the Username,password, Consumer Key,Consumer secret and they should be authenticating in to Salesforce to get the URI and session ID. Using the SessionID and URI the should be able to call the API that is exposed above. Is this the right approach, please let me know if I am missing anything here.
Also there is a requirement to use Swagger with the API, is it possible to use the Swagger within the Apex Class. Can you please help how I can leverage Swagger with my API here.
  • February 03, 2020
  • Like
  • 0
Hello Experts,

I am new to Salesforce and learning how to Integrate Salesforce with any external application. I have read many articles as how to expose the Apex Class as Rest API / call the external System Rest API using apex class. But I am not able understand the use of Swagger with Salesforce how can it benefit with Rest API integration.

Can also share if there are any sample to get us started 

Please help me with this
  • January 31, 2020
  • Like
  • 0
Hello Experts,

I am new to Salesforce and looking for your advice in making an Integration between Salesforce and D365 ERP application. We need to schedule batch send the data from the Salesforce to D365. From D365 we have the Rest API's which can call from Salesforce. I was reading lot of different articles on the REST API interfacing from Salesforce either using future callouts(looks like there is no garaunteed order  for this) / Pooling using REST/SOAP. I am really confused with many different option, please recommend a solution that you would be using this case of scenario. 

Any help is much appreciated

Thanks
  • January 29, 2020
  • Like
  • 0
We are currently working on moveing from Classic UI to Lightning Interface and I would like to get advice from the experts who are already using Lightning Interface.
I setup all the settings to enable the Customizable Camapaign Influence and I am able to see the Camapign Influence related list on the Lightning Interface with the older Camapign records but the issue is we dont see Add to Camapign button on the related list
User-added image
As suggested in the forums I created a custom Camapaign Model and made it as default, the issue is it removes all the Camapigns on the existing Opp record. 
User-added image
 Above picture is on the same Opp record after I enabled the Custom Model as default. I also read this in the Knowledge article here (https://help.salesforce.com/articleView?id=000315113&type=1&mode=1)
 
  • When Users enable this new Campaign Influence, by default Salesforce will provide the 'Salesforce Model.' This model will serve as the Primary model, and Locked Campaign influence records for a locked model can only be added or edited via workflows or the API. Users will not be able to add records manually in Salesforce.

Do we need to create workflows to add Camapign to Opp with default model? Can anyone please share the info on this
  • January 21, 2020
  • Like
  • 0
We are in the process of migrating the our Salesforce instance from classic to lightning. Just realized that the Content delivery is not supported in lightning. Can anyone suggest me what the work around for achieving this in lightning. I also looked in to the Salesforce documentation
In Lightning Email generates delivery-based links as email attachments for Lightning Experience users who have access to the Content Deliveries feature.
I am not able to understand how Email generates delivery-based links as email attachments, can you anyone please help me wat waorkaround you are using. in your organization to solve this. 

User-added imageHas anyone used the lightning component like suggested above
  • January 17, 2020
  • Like
  • 0
I am trying to create a quick Action that calls the flow and lightning component to create a record as suggested in the blog (https://thewizardnews.com/2018/08/02/url-hack-functionality-lightning/) here. I need to create a record of custom object from Opportunity record , using the Quick action as suggested in the blog. I created a flow like below with the Action which calls the lightning component createAXProjectRecords 
User-added image
And the Lightning component is like
createAXProjectRecords.cmp
<aura:component implements="lightning:availableForFlowActions"> <aura:attribute name="InputContactID" type="String" /> <aura:attribute name="InputAccountID" type="String" /> </aura:component>
createAXProjectRecords.design
<design:component> <design:attribute name="InputContactID" /> <design:attribute name="InputAccountID" /> </design:component>
createAXProjectRecordsController.js
({ invoke : function(component, event, helper){ var ContactID = component.get("v.InputContactID"); var AccountID = component.get("v.InputAccountID"); var createRecordEvent = $A.get("e.force:createRecord"); createRecordEvent.setParams({ "entityApiName": "AX_Project__c", "defaultFieldValues": { 'Contact__c' : ContactID, 'Account__c': AccountID } }); createRecordEvent.fire(); } })
When I try to click on the Quick Action on the Opportunity record I get  
User-added image
Can anyone please suggest me what I am missing here.
  • January 08, 2020
  • Like
  • 0
I am trying to convert a detail page button which sets the default value through the Link URL to the lightning. 

User-added image

In the lightning it doesnt work setting the default values (in my other post it was said that this feature will be available in Lightning in the Spring'20 release and suggested the work around can be Quick Actions. I tried the quick Actions but the issue is I cannot set the default values for the lookup fields

User-added image

Is there any other way I can approach this using VisualForce Page/ Lightning Component. I am new to Salesforce and Any help is greatly appreciated.
  • January 07, 2020
  • Like
  • 0
We are planning to move from our SF Classic to Lightning environment and in the process of converting the VisualForce Page to Lightning compatible. I have a page which is like
     
      <apex:page standardController="Opportunity"   extensions="Camp_Ext" id="page" showHeader="false" sidebar="false" > <script> function setFocusOnLoad() {} window.onkeydown=function(){window.focus();} </script> <apex:form id="form"> ...

I am seeing the error in the lightning Convertor Tool like
User-added imageAs the showHeader is set to false I am not very much worried about the 3rd warning. I also added the lightningStylesheets="true" but how can I get rid of the Window and Custom JS warning/error
  • December 18, 2019
  • Like
  • 0
I trying to test the Apex Call outs which uses the OAuth Authentication. I am not sure what I am missing here it throws error on the line HttpResponse res1 = http1.send(req1); like 

Line: 22, Column: 1
System.UnexpectedException: java.lang.IllegalArgumentException: invalid start or end
public class TestD365API {
    public final String clientId = 'xxxxxxxxxxxxx';
    public final String clientSecret = 'xxxxxxxx';
    
    public String getD365Customer(){             
        String reqbody = 'grant_type=client_credentials&client_id='+clientId+'&client_secret='+clientSecret;
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setBody(reqbody);
        req.setMethod('POST');
        req.setEndpoint('https://login.microsoftonline.com/tenant/oauth2/token');
        HttpResponse res = h.send(req);
        deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.class);
        String atoken = resp1.access_token;
        
        
        Http http1 = new Http();
        HttpRequest req1 = new HttpRequest();
        req1.setEndpoint('https://dev-xyz/data/Customers');
        req1.setMethod('GET');
        req1.setHeader('Authorization','Bearer '+atoken);
        HttpResponse res1 = http1.send(req1);
        System.debug('Response Body=========' + res1.getBody());
        return res1.getBody();   
    }  
    
    public class deserializeResponse
    {
        public String token_type;
        public String expires_in;
        public String ext_expires_in;
        public String expires_on;
        public String not_before;
        public String resource;
        public String access_token;
    }
}
Please help me fixing this issue.
  • February 13, 2020
  • Like
  • 1
I am trying to add the HelpText in to the VF Page and I tried few options like below and none of them is working for me. Added the HelpText in the <apex:pageblockSectionItem>
<apex:pageblockSectionItem >
   <apex:outputPanel >
      <div class="ListLevel02">
         <apex:outputLabel value="Type 1" HelpText = "Test"></apex:outputLabel>
      </div> 
   </apex:outputPanel>
   <apex:inputcheckbox value="{!conRec.Type_I__c}" styleClass="ListLevel02"></apex:inputcheckbox>
  </apex:pageblockSectionItem>
User-added image
HelpText is not enabled and cant click on them. I tried to have the HelpText added at the field
User-added image
And tried using them like
<apex:pageblockSectionItem HelpText = '{!$ObjectType.Contact.Fields.Type_I__c.inlineHelpText}'>


Even this has the same behaviour. Can anyone say what am I missing here
  • July 13, 2020
  • Like
  • 0
I have input Checkboxes in the VF page on the Lead record with the requirement that if one of the field is checked the other should be checked as well when the save button is clicked on the VF Page and it is the same when being unchecked
User-added imageThere is this 3rd field on the Lead record which dont exists on the VF Page but needs to updated depending on the above two fields
User-added imagebelow is what I tried
VF Page
<apex:pageblockSectionItem >
                        <apex:outputPanel >
                            <div class="ListLevel01">
                                <apex:outputLabel value="Type 1"></apex:outputLabel>
                            </div> 
                        </apex:outputPanel>
                        <apex:inputcheckbox value="{!leadRec.Type_I_AI__c}" styleClass="ListLevel01">
                            <apex:actionSupport event="onchange" reRender="form" status="status"/>
                        </apex:inputcheckbox>
                    </apex:pageblockSectionItem>
                    <apex:pageblockSectionItem >
                        <apex:outputPanel >
                            <div class="ListLevel01">
                                <apex:outputLabel value="Type 1"></apex:outputLabel>
                            </div> 
                        </apex:outputPanel>
                        <apex:inputcheckbox value="{!leadRec.Type_I_DOM__c}" styleClass="ListLevel01">
                            <apex:actionSupport event="onchange" reRender="form" status="status"/>
                        </apex:inputcheckbox>
                    </apex:pageblockSectionItem>

             ..................
  </apex:pageblock>    
  <apex:commandButton value="Save" style="margin-left:900px;" action="{!finalUpdates}" rerender="form"  oncomplete="RefreshPrimaryTab('{!Lead.id}'); return true;" />
 </apex:form>
The finalUpdates updates the Lead record which in turn fires the trigger like below
set<Id> leadIds = new set<Id>();
    for(Lead l : Trigger.new){
        leadIds.add(l.Id);
    }
    if(!leadIds.isempty() && checkRecursiveTrigger.ranOnce == false)
       LeadTriggerHandler.updateAOI(trigger.newMap, trigger.oldMap);
}
Apex Class
Public class LeadTriggerHandler{
 public static void updateAOI(Map<Id, Lead> newLeads, Map<Id, Lead> oldLeads){
    Set<Id> resultIds = (new Map<Id,Lead>(newLeads)).keySet();
           List<Lead> Leadlist = [Select Id, Type_I__c,Type_I_AI__c,Type_I_DOM__c
                               from Lead WHERE Id IN: resultIds];
        List<Lead> updateList = new List<Lead>();
        set<id> LeadIds= new set<Id>();
        for(Lead l : Leadlist){
                     if(   newLeads.get(l.Id).Type_I_DOM__c == true || newLeads.get(l.Id).Type_I_AI__c  == true)
            {
                l.Type_I_DOM__c = true;
                l.Type_I_AI__c  = true;
                l.Type_I__c = true;
                if(!leadIds.contains(l.Id)){
                    leadIds.add(l.Id);
                    updateList.add(l);
                }                
            }
            
            if(newLeads.get(l.Id).Type_I_DOM__c == false || newLeads.get(l.Id).Type_I_AI__c  == false)
            {
               l.Type_I_DOM__c = false;
                l.Type_I_AI__c  = false;
                l.Type_I__c = false;
                if(!leadIds.contains(l.Id)){
                    leadIds.add(l.Id);
                    updateList.add(l);
                }                
            }
         .............
But this doesnt work as expected, it executes both the if condition if condition if I just click on just one field and not even touch the other field in the end even if 1 field is selected I see false on all the three fields. I now understand my approach here is wrong but not sure how to handle it. Any help is greatly appreciated
  • July 13, 2020
  • Like
  • 0
I have a lightning button I created with the API name of "Merge_ADV" It's a detail page button with a URL source content. Here's the button:
/apex/APXTConga4__Conga_Composer 
?serverUrl={!API.Partner_Server_URL_290} 
&id={!Account.Id} 
&templateid=a2J0V000001jNnn,a2J0V000001jNns,a2J0V000001jNo3,a2J0V000001jNo7,a2J0V000001jNoH,a2J0V000001jNnx,a2J0V000001jNnt,{!Account.ADV_Template_ID__c}&OFN+ENG]&AWD=1

I keep getting this error:
The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores. 
 
Any help is appreciated.
I have written a lightning cmp and controller for a button which calls a VF pagw which renders PDF

CMP
<aura:component implements="force:lightningQuickAction" >
   <lightning:button label="PDF" 
        onclick="{!c.PDF}" />
</aura:component>

Controller :
/* Component controller */
({
 PDF : function(sforce.one.navigateToURL('/apex/Letter?Parameter1=data1'));

})

I'm unable to save my controller as its throwing an error msg

VF page
<apex:page controller="MyController" renderAs="pdf" applyBodyTag="false">
<head>
<style>
body { font-family: 'Arial Unicode MS'; }

@page{
    size: letter;
    margin:10%;
    @top-left{
        content: "Dear,";
        font-family: Helvetica, Arial, sans-serif;
        font-size: 12px;
    }
    @bottom-right{
        content: "Yours Sincerely,";
        font-family: Helvetica, Arial, sans-serif;
        font-size: 10px;
    }
}

body {
        font-family: Helvetica, Arial, sans-serif;
        font-size: 11px;
}
    </style>
</head>
    <div align="right"><strong>Date</strong>: {!DAY(Today())} {!CASE(MONTH(Today()), 1, 'January', 2, 'February', 3, 'March', 4, 'April', 5, 'May', 6, 'June', 7, 'July', 8, 'August', 9, 'September', 10, 'October', 11, 'November', 12, 'December', 'Unknown')} {!YEAR(Today())}</div>
<center>
    <h1> Letter</h1>
    </center>
    <p>{!custom_object__C.Name__C}</p>    
</apex:page>

​Custom Button:


window.open("apex/Letter?Id={!Letter__c.Id}","_blank");

Hi,

 

We are looking to  create a record (Asset) as an appliance in an external system from Salesforce.

 

This would get triggered when a button is clicked upon on the Asset object

 

Can you please guide to some code samples that use REST APIs to connect to external systems and insert records in it and in return fetch a value which is created in the external system.

 

 

Requests:


Action |HTTP Method| URL|
Create | POST | http://xyz.com/sfapi/appliance/
Read GET http://rxyz.com/sfapi/appliance/:id
Update PUT http://xyz.com/sfapi/appliance/:id
Delete DELETE http://rmc.com/sfapi/appliance/:id