• SFDC Learning
  • NEWBIE
  • 45 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 11
    Replies

I am getting the below error when i am trying to update the number datatype field value through sorting process with the existing bumber datatype field values.

The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 301190000009lGd. Flow error messages: <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.

Can anyone help with this issue.

Thanks
Venkata

 

 

Hi,
I am looking out for the regex match for the Exact string. 

For Example The sentence is: Hi there is cow and cowis white.and i want to remove only 'cow' string. 

String s2 = 'Hi there is cow and cowis white';
String strRegEx ='\\[cow]\\';

Pattern MyPattern = Pattern.compile(strRegEx);
Matcher MyMatcher = MyPattern.matcher(s2);
Boolean result = MyMatcher.find();

if(MyMatcher.find()) {
   s2 = s2.replaceall(strRegEx, ' ');
}

It is not working and if it woking the result is retunrs is 'Hi there is and is white'. Basically i just want to ignore the substrings to be removed.

Thanks in advance.
Here is my code: 

Global class SendAccountUsingRESTAPI {
  
      public String id;
      public String access_token;
      
     
  webservice static void RESTApiToAccount(id AccountId)
 
   {
      String clientId = 'xxxxx';
      String clientSecret = 'xxxx';
      String username = 'xxxxxx';
      String password = 'xxxxx';
    
     String reqbody = 'grant_type=password&client_id='+clientId+'&client_secret='+clientSecret+'&username='+username+'&password='+password;
   
     Http h = new Http();
      HttpRequest req = new HttpRequest();
      req.setBody(reqbody);
      req.setMethod('POST');
      req.setEndpoint('https://ap4.salesforce.com/services/oauth2/token');
      HttpResponse res = h.send(req);
     SendAccountUsingRESTAPI resp1 = (SendAccountUsingRESTAPI)JSON.deserialize(res.getbody(),SendAccountUsingRESTAPI.class);
     system.debug('@@@@access_token@@'+resp1 );
          
           String accessToken;
         
           accessToken = resp1.access_token;


           if(accessToken != null){
           String endPoint = 'https://ap4.salesforce.com/services/apexrest/Account';
           JSONGenerator gen = JSON.createGenerator(true);
          Account a=[select id,name,website from account where id=:AccountId];
           gen.writeStartObject();
           gen.writeStringField('name', a.name);
           gen.writeStringField('id', a.id);
           gen.writeStringField('website', a.website);
          
           String s=gen.getasString();
          
           Http h2 = new Http();
           HttpRequest req1 = new HttpRequest();
           req1.setHeader('Authorization','Bearer ' + accessToken);
           req1.setHeader('Content-Type','application/json');
           req1.setHeader('accept','application/json');
           

           req1.setBody(s);           
           req1.setMethod('POST');
           req1.setEndpoint(endPoint);
           HttpResponse res1 = h2.send(req1);
           String trimmedResponse = res1.getBody();
           system.debug('sasasasa'+res1);
           system.debug('@@@RESPONSE@@'+trimmedResponse);
           JSONParser parser = JSON.createParser(res1.getBody());
          
            
            
           
         }
   }
  
  
}


Here is my test classes: 

@isTest
public class MockHttpResponseGenerator implements HttpCalloutMock {
    // Implement this interface method
    
    public HTTPResponse respond(HTTPRequest req) {
    
    
             String endpoint = req.getEndpoint();


   
        if ( endpoint.contains('oauth2/token') ) {
            return buildOAuthResponse( req );
        } else if ( endpoint.contains('/services/apexrest/Account') ) {
            return buildShortenResponse( req );
        }

        return null;
    }

  private HttpResponse buildOAuthResponse( HttpRequest req ) {

        HttpResponse res = new HttpResponse();

        res.setBody('123');
        res.setStatusCode(200);

        return res;
    }

    private HttpResponse buildShortenResponse( HttpRequest req ) {

       HttpResponse res = new HttpResponse();
  
      //    JSONGenerator gen = JSON.createGenerator(true);
       //    gen.writeStartObject();
      //     gen.writeStringField('name','test');
     //      gen.writeStringField('id', '6546466');
    //       gen.writeStringField('website', 'vsbjs.com');
          
          String s=;
         res.setBody('{"Name": "sForceTest1"}]');
        res.setHeader('Content-Type', 'application/json');
        res.setStatusCode(200);
        

        return res;
   
    }
}


2nd test class: 

@isTest
private class CalloutClassTest {
  
  @isTest
    static void myTest() {        // Set mock callout class 
       
      Test.startTest();
 
      Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());

       Account a=new account();
       a.name='test';
       a.website='www.test.com';
     
       SendAccountUsingRESTAPI.RESTApiToAccount(a.id);
       Test.StopTest();
        
    }
}

Thank you in advance
Here is my button code: 


{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 
var result = sforce.apex.execute("SendAccountUsingRESTAPI","callgetContact",{IDD:"{! 
Account.Id}"});



APex class which i m calling: 

Global class SendAccountUsingRESTAPI {
  

  Global class deserializeResponse
   {
      public String id;
      public String access_token;
   } 
 
   webservice static void callgetContact(Id IDD)
   { }
}

When i am clicking on button it gives me an error: {faultcode:'soapenv:Client', faultstring:'No operation available for request {http://soap.sforce.com/schemas/package/SendAccountUsingRESTAPI }callgetContact, please check the WSDL for the service.', }"

Thank you in advance!
My apex class : 



public class fatchAccountRecords{
    public static String fetchAccounts(){
        string strSessionid = loginsalesforce.login();
        
        HttpRequest req = new HttpRequest();        
        //String strEndpointURL = 'https://na15.salesforce.com/services/apexrest/BoxRecords';
        String strEndpointURL = 'https://111-dev-ed.my.salesforce.com/services/apexrest/Account';
        req.setEndpoint(strEndpointURL);
        req.setMethod('GET');  
       
         Account acc=[select id,name,phone,website from account where id='0019000001nz3Zq'];
       
        String naame=acc.name;
        req.setBody('<?xml version="1.0" encoding="UTF-8"?><request><name>'+ naame +'</name></request>');
  
     system.debug('ssssssssssssssssssss'+req.getbody());
   
        //req.setBody(''); 
        req.setTimeout(60000);
        req.setHeader('Authorization','Bearer '+strSessionid );
        req.setHeader('Content-Type', 'application/json; charset=UTF-8');        

        HttpResponse res =  new Http().send(req);
        system.debug('response'+ res);
        system.debug('response'+ res.getBody());
        return res.getBody();
    }    
}


On destination org APEX class: 

@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
  
  @HttpPost
    global static String doPost(String name) {
        Account account = new Account();
        account.Name = name;
       // account.phone = phone;
       // account.website = website;
        insert account;
        return account.Id;
    }
}

It is giving the15:46:12:444 USER_DEBUG [25]|DEBUG|response[{"message":"Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [line:1, column:2]","errorCode":"JSON_PARSER_ERROR"}] 

Thanks in advance
 
Thanks in advance,

if(searchbyname.length()==0){
    }else{
    
     if(accname==null){
            lstAcct=[Select id,name from Account WHERE  Lock__c=:false AND name LIKE  : searchbyname  ORDER BY Name ASC];

     }else{
    lstAcct=[Select id,name from Account WHERE Sales_Mgr__c= : accname AND Lock__c=:false AND name LIKE  : searchbyname  ORDER BY Name ASC];
   }
    }


I want to execute this code with single query.help me.
for(Task tt :trigger.new)
{
    if(tt.whoId!=null  && tt.who.Name=='Lead'){
        lead=[select id,Fast_Phone__c from Lead where id =:tt.whoId ]; 

In test class when i am creating lead and insert it id into task . the if condition 'if(tt.whoId!=null  && tt.who.Name=='Lead')' is not matching. How to resolve this

Thanks in advance

 
I want to delete duplicate tasks from my org ,because of workflow rule duplicate tasks are assigned to users so how to remove duplicate data

Thanks in advance
Hi helpers,
Please give me the solution for this error . i am implementing bulk API and getting error during generation of partner.jar file. The error is
Error:Exception in thread "main" java.lang.NoClassDefFoundError
Please help me..

Thanks in advance
I want to make a animated introductory video for my product Marketing . So can you please suggest me any free sites or how can i make it ?

Thank you in advance 
want to connect form with custom object fileds , web to custom object(Like web to lead) is it possible?
Thank you in advance
Hi,
I am looking out for the regex match for the Exact string. 

For Example The sentence is: Hi there is cow and cowis white.and i want to remove only 'cow' string. 

String s2 = 'Hi there is cow and cowis white';
String strRegEx ='\\[cow]\\';

Pattern MyPattern = Pattern.compile(strRegEx);
Matcher MyMatcher = MyPattern.matcher(s2);
Boolean result = MyMatcher.find();

if(MyMatcher.find()) {
   s2 = s2.replaceall(strRegEx, ' ');
}

It is not working and if it woking the result is retunrs is 'Hi there is and is white'. Basically i just want to ignore the substrings to be removed.

Thanks in advance.
Here is my code: 

Global class SendAccountUsingRESTAPI {
  
      public String id;
      public String access_token;
      
     
  webservice static void RESTApiToAccount(id AccountId)
 
   {
      String clientId = 'xxxxx';
      String clientSecret = 'xxxx';
      String username = 'xxxxxx';
      String password = 'xxxxx';
    
     String reqbody = 'grant_type=password&client_id='+clientId+'&client_secret='+clientSecret+'&username='+username+'&password='+password;
   
     Http h = new Http();
      HttpRequest req = new HttpRequest();
      req.setBody(reqbody);
      req.setMethod('POST');
      req.setEndpoint('https://ap4.salesforce.com/services/oauth2/token');
      HttpResponse res = h.send(req);
     SendAccountUsingRESTAPI resp1 = (SendAccountUsingRESTAPI)JSON.deserialize(res.getbody(),SendAccountUsingRESTAPI.class);
     system.debug('@@@@access_token@@'+resp1 );
          
           String accessToken;
         
           accessToken = resp1.access_token;


           if(accessToken != null){
           String endPoint = 'https://ap4.salesforce.com/services/apexrest/Account';
           JSONGenerator gen = JSON.createGenerator(true);
          Account a=[select id,name,website from account where id=:AccountId];
           gen.writeStartObject();
           gen.writeStringField('name', a.name);
           gen.writeStringField('id', a.id);
           gen.writeStringField('website', a.website);
          
           String s=gen.getasString();
          
           Http h2 = new Http();
           HttpRequest req1 = new HttpRequest();
           req1.setHeader('Authorization','Bearer ' + accessToken);
           req1.setHeader('Content-Type','application/json');
           req1.setHeader('accept','application/json');
           

           req1.setBody(s);           
           req1.setMethod('POST');
           req1.setEndpoint(endPoint);
           HttpResponse res1 = h2.send(req1);
           String trimmedResponse = res1.getBody();
           system.debug('sasasasa'+res1);
           system.debug('@@@RESPONSE@@'+trimmedResponse);
           JSONParser parser = JSON.createParser(res1.getBody());
          
            
            
           
         }
   }
  
  
}


Here is my test classes: 

@isTest
public class MockHttpResponseGenerator implements HttpCalloutMock {
    // Implement this interface method
    
    public HTTPResponse respond(HTTPRequest req) {
    
    
             String endpoint = req.getEndpoint();


   
        if ( endpoint.contains('oauth2/token') ) {
            return buildOAuthResponse( req );
        } else if ( endpoint.contains('/services/apexrest/Account') ) {
            return buildShortenResponse( req );
        }

        return null;
    }

  private HttpResponse buildOAuthResponse( HttpRequest req ) {

        HttpResponse res = new HttpResponse();

        res.setBody('123');
        res.setStatusCode(200);

        return res;
    }

    private HttpResponse buildShortenResponse( HttpRequest req ) {

       HttpResponse res = new HttpResponse();
  
      //    JSONGenerator gen = JSON.createGenerator(true);
       //    gen.writeStartObject();
      //     gen.writeStringField('name','test');
     //      gen.writeStringField('id', '6546466');
    //       gen.writeStringField('website', 'vsbjs.com');
          
          String s=;
         res.setBody('{"Name": "sForceTest1"}]');
        res.setHeader('Content-Type', 'application/json');
        res.setStatusCode(200);
        

        return res;
   
    }
}


2nd test class: 

@isTest
private class CalloutClassTest {
  
  @isTest
    static void myTest() {        // Set mock callout class 
       
      Test.startTest();
 
      Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());

       Account a=new account();
       a.name='test';
       a.website='www.test.com';
     
       SendAccountUsingRESTAPI.RESTApiToAccount(a.id);
       Test.StopTest();
        
    }
}

Thank you in advance
My apex class : 



public class fatchAccountRecords{
    public static String fetchAccounts(){
        string strSessionid = loginsalesforce.login();
        
        HttpRequest req = new HttpRequest();        
        //String strEndpointURL = 'https://na15.salesforce.com/services/apexrest/BoxRecords';
        String strEndpointURL = 'https://111-dev-ed.my.salesforce.com/services/apexrest/Account';
        req.setEndpoint(strEndpointURL);
        req.setMethod('GET');  
       
         Account acc=[select id,name,phone,website from account where id='0019000001nz3Zq'];
       
        String naame=acc.name;
        req.setBody('<?xml version="1.0" encoding="UTF-8"?><request><name>'+ naame +'</name></request>');
  
     system.debug('ssssssssssssssssssss'+req.getbody());
   
        //req.setBody(''); 
        req.setTimeout(60000);
        req.setHeader('Authorization','Bearer '+strSessionid );
        req.setHeader('Content-Type', 'application/json; charset=UTF-8');        

        HttpResponse res =  new Http().send(req);
        system.debug('response'+ res);
        system.debug('response'+ res.getBody());
        return res.getBody();
    }    
}


On destination org APEX class: 

@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
  
  @HttpPost
    global static String doPost(String name) {
        Account account = new Account();
        account.Name = name;
       // account.phone = phone;
       // account.website = website;
        insert account;
        return account.Id;
    }
}

It is giving the15:46:12:444 USER_DEBUG [25]|DEBUG|response[{"message":"Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [line:1, column:2]","errorCode":"JSON_PARSER_ERROR"}] 

Thanks in advance
 

I am getting the below error when i am trying to update the number datatype field value through sorting process with the existing bumber datatype field values.

The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 301190000009lGd. Flow error messages: <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.

Can anyone help with this issue.

Thanks
Venkata

 

 

Hi helpers,
Please give me the solution for this error . i am implementing bulk API and getting error during generation of partner.jar file. The error is
Error:Exception in thread "main" java.lang.NoClassDefFoundError
Please help me..

Thanks in advance
Hi I have a custom report (Activities with Case) created like this ->

User-added image

Now I would like to add an additional column and value would be 'Email - Received' - 'Email - Sent'. Possible to do that?