• Nag22
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 2
    Replies
Hi,

I am working on integration with docusign.

I have created an Rest Resouce class to update record in salesforce, and  I have give this  class URL like
https://test.salesforce.com/apexrest/services/UpdateRecord

Now docusign is calling this URL when ever the docusign database updated. But while calling this URL docusign getting

https://cs5.salesforce.com/services/apexrest/UpdateRecord:: Error - The remote server returned an error: (401) Unauthorized  ERROR.
public void sendTemplateWithDetails(){
    
        String passString = authHeader();  //THIS METHOD CONTAINS ALL THE CREDENTIALS OF DOCUSIGN
        Http httpProtocol = new Http();
        HttpRequest request = new HttpRequest();
        String endpoint = templateWrap.uri+'/envelopes';
        String xmlStr;
        if(oppty.id != null){
           xmlStr =  '<envelopeDefinition xmlns=\'http://www.docusign.com/restapi\'>' +
                    '<accountId>' + oppty.accountId + '</accountId>' +
                    '<status>sent</status>' +   // 'sent' to send envelope, 'created' to save as draft envelope
                    '<emailSubject>DocuSign API Call - Signature request from template</emailSubject>' +
                    '<templateId>' + templateId + '</templateId>' + 
                    '<templateRoles>' + 
                    '<templateRole>' +  
                    '<name>' + Account.Name+ '</name>' +
                    '<email>' + Account.personEmail+ '</email>' +               
                    '<roleName>' + 'Client' + '</roleName>' + 
                    '</templateRole>' + 
                    '</templateRoles>' + 
                    '<eventNotification>' +
                       '<EnvelopeEvents>' +
                          '<envelopeEvent>' +
                             '<envelopeEventStatusCode>'+'Completed'+'</envelopeEventStatusCode>' +
                          '</envelopeEvent>' +
                          '<envelopeEvent>' +
                             '<envelopeEventStatusCode>'+'Delivered'+'</envelopeEventStatusCode>' +
                          '</envelopeEvent>' +
                       '</EnvelopeEvents>' +
                       
                       '<loggingEnabled>'+'true'+'</loggingEnabled>' +
                       '<recipientEvents>' +
                          '<recipientEvent>' +
                             
                             '<recipientEventStatusCode>'+'Delivered'+'</recipientEventStatusCode>' +
                          '</recipientEvent>' +
                          '<recipientEvent>' +
                             '<recipientEventStatusCode>'+'Completed'+'</recipientEventStatusCode>' +
                          '</recipientEvent>' +
                       '</recipientEvents>' +
                      '<url>'+'https://cs5.salesforce.com/services/apexrest/UpdateOpportunityStatus'+'</url>'+   
                    '</eventNotification>'+
                    '</envelopeDefinition>';

        }

        request.setEndPoint(endpoint);
        request.setBody(xmlStr);
        request.setMethod('GET');
        request.setHeader('Content-Type', 'application/xml');
        request.setHeader('Content-Disposition', 'form-data');
        request.setHeader('X-DocuSign-Authentication', passString);
        
        system.debug('***********request body***'+request.getBody());
        HttpResponse response1 = httpProtocol.send(request);
How to authenticate to salesforce, when external system calling our URL to update records?

anyone help me to figure out this.
  • September 13, 2014
  • Like
  • 0
Hi

I am working with ternary operator , but it always giving false value

string resName';

resName =  (obj.order_number__c == 1) ?obj.Response : ' NA';

Here order number type is number
Response is Text
But above ternary expression always gives 'NA'.

I tried with native IF like

if(obj.order_number__c == 1)
     resName = obj.Response;
else
    resName = 'NA';

the above code is working fine, but it is not working by using ternary operator.
Anyone explain me the why it is not working.
  • August 20, 2014
  • Like
  • 0
Hi
I am working on one secnario where I need to remove some items from list at the same time I need to add set of items to the list.

Example
list contains 30 items  1,2,3,4,5,6,7.............30

Each item having Yes, no optons like this

1. some question
Yes (radio buttons)
No

If I click on Yes I need to remove 3,4,5 questions
If I click  on No I need to remove 7,8 and I have to add 3,4,5 to the list questions as well. (both adding and removing should done at same time)

on every click I am rerendering the page.

Help me to figure out this.
  • July 30, 2014
  • Like
  • 0
Hi

I am working on a requirment where list of questions with options(radio, checkbox, freeText) should be displayed in the page, when ever user enters the responses
that responses should be saved in the database automatically.


For that I am using autosave (action pollar with 5 seconds), then what happens is we have some validations on record saving like phone number should be 10 digits.
If I enter 5 digits  AUTOSAVE has performed and giving error.

Is there any alternative to saving the live data automatically while typing the telecaller.
  • July 29, 2014
  • Like
  • 0
Hi ,

I have written hide functionality in my visualforce page  based on redio buttons YES/No selection, if YES one block will be displayed.
For that I have used below code .
function ShowHideNo(divId,val)
        {
       
            if( val  == 'Yes' )
            {
                document.getElementById(divId).style.display='block';
            }
            else
            {
                document.getElementById(divId).style.display = 'none';
            }
        }

The above code is working fine with android devices but incaseo of
IOS when ever I selected 'Yes' it refreshes to top of the page. But in android devices its not happening like that its working perfectly.

it needs to work IOS devices as well, how can I get rid of this conflict , anyone know please let me know.
  • June 02, 2014
  • Like
  • 0
  • September 26, 2013
  • Like
  • 0

HI....

 

There are 2 objects one ObjA and ObjB  . On objA there is a TEXT field  and these values are refer to ObjB NAME field.

Now I want to copy the id of ObjB into ObjA as lookup.. for  that I have written a trigger

Is this trigger bulkified or not?

If not any suggestions to improve my code for bulkification?

 

trigger PriceTrig on Ales__c (before insert,before update) {

 list<String> Str= new list<String>();
  
  for(Ales__c S:trigger.new){
    Str.add(S.Prod__c);
  }


 list<SProducts__c> Prod= [select id,name from SProducts__c where name in: Str limit 1000];
   
    for(Ales__c SNEW:trigger.new){
     
       for(SProducts__c SP:Prod){
       
           if(SNEW.prod__c == SP.name){
            
                SNEW.SProductid__c = SP.id;        
           }
       }
    }
        
}

 

 

  • February 05, 2013
  • Like
  • 0
Hi,

I am working on integration with docusign.

I have created an Rest Resouce class to update record in salesforce, and  I have give this  class URL like
https://test.salesforce.com/apexrest/services/UpdateRecord

Now docusign is calling this URL when ever the docusign database updated. But while calling this URL docusign getting

https://cs5.salesforce.com/services/apexrest/UpdateRecord:: Error - The remote server returned an error: (401) Unauthorized  ERROR.
public void sendTemplateWithDetails(){
    
        String passString = authHeader();  //THIS METHOD CONTAINS ALL THE CREDENTIALS OF DOCUSIGN
        Http httpProtocol = new Http();
        HttpRequest request = new HttpRequest();
        String endpoint = templateWrap.uri+'/envelopes';
        String xmlStr;
        if(oppty.id != null){
           xmlStr =  '<envelopeDefinition xmlns=\'http://www.docusign.com/restapi\'>' +
                    '<accountId>' + oppty.accountId + '</accountId>' +
                    '<status>sent</status>' +   // 'sent' to send envelope, 'created' to save as draft envelope
                    '<emailSubject>DocuSign API Call - Signature request from template</emailSubject>' +
                    '<templateId>' + templateId + '</templateId>' + 
                    '<templateRoles>' + 
                    '<templateRole>' +  
                    '<name>' + Account.Name+ '</name>' +
                    '<email>' + Account.personEmail+ '</email>' +               
                    '<roleName>' + 'Client' + '</roleName>' + 
                    '</templateRole>' + 
                    '</templateRoles>' + 
                    '<eventNotification>' +
                       '<EnvelopeEvents>' +
                          '<envelopeEvent>' +
                             '<envelopeEventStatusCode>'+'Completed'+'</envelopeEventStatusCode>' +
                          '</envelopeEvent>' +
                          '<envelopeEvent>' +
                             '<envelopeEventStatusCode>'+'Delivered'+'</envelopeEventStatusCode>' +
                          '</envelopeEvent>' +
                       '</EnvelopeEvents>' +
                       
                       '<loggingEnabled>'+'true'+'</loggingEnabled>' +
                       '<recipientEvents>' +
                          '<recipientEvent>' +
                             
                             '<recipientEventStatusCode>'+'Delivered'+'</recipientEventStatusCode>' +
                          '</recipientEvent>' +
                          '<recipientEvent>' +
                             '<recipientEventStatusCode>'+'Completed'+'</recipientEventStatusCode>' +
                          '</recipientEvent>' +
                       '</recipientEvents>' +
                      '<url>'+'https://cs5.salesforce.com/services/apexrest/UpdateOpportunityStatus'+'</url>'+   
                    '</eventNotification>'+
                    '</envelopeDefinition>';

        }

        request.setEndPoint(endpoint);
        request.setBody(xmlStr);
        request.setMethod('GET');
        request.setHeader('Content-Type', 'application/xml');
        request.setHeader('Content-Disposition', 'form-data');
        request.setHeader('X-DocuSign-Authentication', passString);
        
        system.debug('***********request body***'+request.getBody());
        HttpResponse response1 = httpProtocol.send(request);
How to authenticate to salesforce, when external system calling our URL to update records?

anyone help me to figure out this.
  • September 13, 2014
  • Like
  • 0
Hi

I am working on a requirment where list of questions with options(radio, checkbox, freeText) should be displayed in the page, when ever user enters the responses
that responses should be saved in the database automatically.


For that I am using autosave (action pollar with 5 seconds), then what happens is we have some validations on record saving like phone number should be 10 digits.
If I enter 5 digits  AUTOSAVE has performed and giving error.

Is there any alternative to saving the live data automatically while typing the telecaller.
  • July 29, 2014
  • Like
  • 0