• Jitukawale
  • NEWBIE
  • 5 Points
  • Member since 2015
  • Salesforce Tech Lead

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
We are using Salesforce lightning experience and on an opportunity page, we have added sales_path component provided by Salesforce.
We have a dependent picklist --> Stage as a controlling field and closure reason dependent field.
When user select close won stage on Sales path component we getting below popup as this is a dependency.

User-added image

When use selects a value and clicks on save button we are getting below error popup. I am very sure that this error is from Sales path component provided by Salesforce. Does anyone have any idea how to resolve this? We are not using any lightning component in the org.

User-added image

Thanks in advanced.


 
Hi All,

I am writing a simple request to upload the file to AWS. I have verified different my calculated signature but still getting an error message in the callout. Refer below code to verify.
 
public static void SendRequest(){    
         
        String fileString='fileString';
        String key='xxxxxxxxxxxxxxx';
        String secret='xxxxxxxxxxxxxxxxxxxxxxxx';
        //String formattedDateString= Datetime.now().formatGMT('EEE,dd MMM yyyy HH:mm:ss z');
        String formattedDateString = Datetime.now().format('EEE, dd MMM yyyy HH:mm:ss z','America/Los_Angeles');
        String bucketname = 'bucket';
        String method = 'PUT';
        String filename = 'MyFile';
        HttpRequest req = new HttpRequest();
        req.setMethod(method);
        
        req.setHeader('Host','bucket.s3.amazonaws.com');
        req.setEndpoint('https://bucket.s3.amazonaws.com' + '/'+ bucketname + '/' + filename);
        req.setHeader('Content-Length', string.valueOf(fileString.length()));
        req.setHeader('Content-Encoding', 'UTF-8');
    //  req.setHeader('Content-Disposition', 'attachment'); 
        req.setHeader('Content-type', 'application/json');        
        req.setHeader('Connection','keep-alive');
        req.setHeader('Date', formattedDateString);
        req.setHeader('ACL','public-read');
        req.setBody(fileString);     
                  
        String stringToSign ='PUT\n\n'+'application/json\n'+formattedDateString+'\n/'+bucketname+'/'+bucketname+'/'+filename;
        String encodedStringToSign = EncodingUtil.urlEncode(stringToSign,'UTF-8');        
        String signed = createSignature(stringToSign,secret);
        String authHeader = 'AWS' + ' ' + key + ':' + signed;
        req.setHeader('Authorization',authHeader);
        String decoded = EncodingUtil.urlDecode(encodedStringToSign , 'UTF-8');        
       
        Http http = new Http();
        try {
             HTTPResponse res = http.send(req);          
             System.debug('*Resp:'+String.ValueOF(res.getBody()));                    
             
             if(res.getStatusCode()==200 && res.getStatus()=='OK')
             {
                 String success= filename +' File has uploaded Successfully.';
//this is executing 
                  //inputFile=null;
             }

            } catch(System.CalloutException e) {
            
        }

   // return ApexPages.Currentpage();
}

 

    public static string createSignature(string canonicalBuffer,String secret){
        string sig;
        Blob mac = Crypto.generateMac('HMACSHA1', blob.valueof(canonicalBuffer),blob.valueof(secret));
        sig = EncodingUtil.base64Encode(mac);  
        return sig;
    }


When I perform callout I am getting a response:

<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>kdjkhkghkjhkhdkhkdhkhfkh</AWSAccessKeyId><StringToSign>PUT

Thanks.

I wanted to read stock price Yahoo or any other site like google finance or msn but cant get any sample code. I tried the following sample  and it is not working now.
https://developer.salesforce.com/blogs/developer-relations/2010/02/spring-10-saw-the-general-availability-of-one-of-my-favorite-new-features-of-the-platform-the-apex-schedulerwith-the-apex-s.html

Is there any public url available free to get stock price?
  • December 12, 2017
  • Like
  • 1
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
 
Hello,

I'm trying to implement a workflow that would trigger if a custom picklist field value related to contacts is selected, 'W9'. 

This is the formula I have, and I'm getting the error that I've entered an Incorrect parameter type for function 'TEXT()', but I don't see an option within formula operators that would apply to alphanumeric strings . . . here is what I have:
AND
(TEXT(EnrollmentrxRx__Active_Enrollment_Opportunity__r.Integration_Applicant_Type__c)='W9',
 
ISBLANK(TEXT(EnrollmentrxRx__Active_Enrollment_Opportunity__r.Integration_Applicant_Type__c)) )
Hello Community,

I have a trigger on the Lead that I would like to execute only when the Lead custom_field_1_c is not populated and Lead custom_field_2_c has the value of approved, but I keep having either syntax errors or an error saying that my variable does not exist. Any help would be appreciated. I have included my current trigger & class that aren't throwing errors. Thank you!

My Current Trigger (not giving an error):
trigger SalesCloudOnboardLead on Lead (after insert, after update) {
for(Lead leadRecord : Trigger.New){
SalesCloudOnboardClass.makeCallout(leadRecord.Id,'Lead');
    }
}

My Current Trigger (giving an error):
trigger SalesCloudOnboardLead on Lead (after insert, after update) {
for(Lead leadRecord : Trigger.New){
(Lead.custom_field_1_c=null && Lead.custom_field_2_c==('Approved'));
SalesCloudOnboardClass.makeCallout(leadRecord.Id,'Lead');
    }
}

My Class (not giving an error):
global class SpheraCloudOnboardClass {
    @future(callout=true)
    public static void makeCallout(String recordID,String recordType) {
    String endpoint='';
      
    if(recordType == 'Lead'){
     endpoint = 'https://demo.salessolutions.com/onboard/trial/type/Lead/id/'+recordID;
        }else if(recordType == 'Contact'){
             endpoint = 'https://demo.salessolutions.com/onboard/trial/type/Contact/id/'+recordID;
          }
               
        HttpRequest request = new HttpRequest();
        // Set the endpoint URL.
        request.setEndPoint(endpoint);
        // Set the HTTP verb to POST.
        request.setMethod('POST');
        // Send the HTTP request and get the response.
        HttpResponse response = new HTTP().send(request);
        }
   }
I am very new to Salesforce and I need to write a trigger which should fire on few formula field updates and should update the other fields in contacts and accounts. So something like this:

Trigger should fire when updates are done to these fields:
From Contact object fields - ED_180_Prior__c (formula date field), Prof_Status__c (text)
From Account object fields - M_Status__c (formula text field), Days_of_MT__c (formula number field).

Trigger should update these fields:
From Contact object - Pardot_ED_180_Prior__c (date field), Pardot_Prof_Status__c (text).
From Accounts object - Pardot_M_status__c (text field), Pardot_Days_of_MT__c (number field)

I have tried this so far:

    trigger updatePardot on Contact (after insert)
    {
        List<contact> conUpdate = new List<Contact>();
        set<Id> sAccId = new set<Id>();
        for(Contact con: trigger.new) {
                sAccId.add(con.AccountId);
        }
        List<Account> lstAccount = [select id, Address_1__c, (select id,Address_1__c from contacts) from account where id IN: sAccId];
        for(Account acc: lstAccount) {
                for(Contact con: acc.contacts) {
                       //con.Address_1__c = acc.Address_1__c;
                       con.Pardot_ED_180_Prior__c = con.ED_180_Prior__c;
                       con.Pardot_Prof_Status__c = con.Prof_Status__c;
                       conUpdate.upsert(con);

                       acc.Pardot_M_status__c = acc.M_status__c;
                       acc.Pardot_Days_of_MT__c = acc.Days_of_MT__c;
                       lstAccount.upsert(acc);
           }
       }
   }

Can someone please help me if I am not doing it correct, or if I should change the approach as soon as possible? Also, should I setup workflow rules for every different field when this trigger should fire? Much thanks in advance.

Hi,

I need to create  a approval process to send an auto response email alert to submitter. When an oppurtunity is "Approved" or "Rejected".
I have created email templates. Please let me know Approval steps i need to take care off.

Thank you.