• NagSha
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi All.,

I am looking at creating case in salesforce like(web to case) from service using Rest/soap api's.

Can you provide me the approach on how to do this.,

 

Is it possible to create subcase to a existing case(Service will have case Id of parent)? 

  • November 13, 2013
  • Like
  • 0

i serialized a list ino JSON String.,

 

I am using HTTP Post to send that json to other end.,

 

I need to handle special characters in my JSON string,

 

Please help me.,

  • December 10, 2012
  • Like
  • 0

Hi Guys.

 

please guide me,

 

i need to send all contacts in the org,when a checkbox field on one particular record is true,

 

Thanks.,

  • November 20, 2012
  • Like
  • 0
// i need to update the salesforce_key in the following json with a custom field in account.


{"JrmiStatus":{"Status":"Local_DB","Error_Category":"Fail","JRM_Key":"001Q000000YJZFsIAP","JRM_Object":"Account","LocalDB_Key":"5109929","LocalDB_Table":"sch_rec","Error_Message":"Record already exist"},"Responses":[{"Salesforce_Key":"001Q000000YJZFsIAP","JRM_Object":"Account","JRM_Field":"External_ID__c","LocalDB_Key":"5109929"}]}


public class JSON2Apex { public class Responses { public String Salesforce_Key; public String JRM_Object; public String JRM_Field; public String LocalDB_Key; } public JrmiStatus JrmiStatus; public List<Responses> Responses; public class JrmiStatus { public String Status; public String Error_Category; public String JRM_Key; public String JRM_Object; public String LocalDB_Key; public String LocalDB_Table; public String Error_Message; } public static JSON2Apex parse(String json) { return (JSON2Apex) System.JSON.deserialize(json, JSON2Apex.class); }
  • October 23, 2012
  • Like
  • 0

Hi Team.,

 

I am NewBie trying to learn.,Any Help is appreciated.,

 

i have a custom field srmid__c in contact object,i am getting the json string as a response when i make a future callout.i need to update the srmid__c with this value.,

 

//Incoming JSON String: {"LocalDB_Key":5109740,"Salesforce_Key":"003Q000000ZsOynIAF","JRM_Object":"Contact","JRM_Field":"srmid__c"}


public class JSONParser {
public Integer LocalDB_Key {get;set;}
public String Salesforce_Key {get;set;}
public String JRM_Object {get;set;}
public String JRM_Field {get;set;}
Http h = new Http();
HttpRequest req = new HttpRequest();
String url = '******************************';
req.setMethod('POST');
req.setEndpoint(url);
req.setTimeout(120000);
HttpResponse res = h.send(req);
JSONParser parser = JSON.createParser(res.getBody());
while (parser.nextToken() != null) {
if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
String text = parser.getText();
parser.nextToken();
if (text == 'LocalDB_Key') {
this.LocalDB_Key = parser.getIntegerValue();
} else if (text == 'Salesforce_Key') {
this.Salesforce_Key = parser.getText();
} else if (text == 'JRM_Object') {
this.JRM_Object = parser.getText();
} else if (text == 'JRM_Field') {
this.JRM_Field = parser.getText();
}
}
}
}

  • October 17, 2012
  • Like
  • 0

 

This is my First Rest Class

Need Some Guidance how to connect the HTTP request object with the below class.,

If i am thinking in wrong way,Let me know the right way.,

I need to update the  LocalDB_key value to SRM_ETL_ID__c in  my salesforce instance.

 

JSON STRING:  

{"LocalDB_Key":5109613,"Salesforce_Key":"001Q000000YJZGCIA5","JRM_Object":
"Account","JRM_Field":"SRM_ETL_ID__c"}

 

Apex Class:

 

public class JSON2Apex {
        public String val(Integer LocalDB_Key,String Salesforce_Key,String JRM_Object,String JRM_Field) {
               Http h = new Http();
               List<Account> trips = new List<Account>();
               HttpRequest req = new HttpRequest();
               String url = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
               req.setEndpoint(url);
               req.setMethod('POST');
               HttpResponse res = h.send(req);
        }

}

 

 

This is the class Generated from Json2Apex for above JSON

 

public class response {

            public Integer LocalDB_Key;
            public String Salesforce_Key;
            public String JRM_Object;
            public String JRM_Field;


            public static response parse(String json) {
            return (response) System.JSON.deserialize(json, response.class);
            }

}

 

 

 

 

 

 

  • October 15, 2012
  • Like
  • 0

i have two custom objects parent: test,child:Application

 

i want to send all test object fields for that specific application.,

 

The query i have

 

lsttest =[Select (Select a.English_Writing_Score__c,a.English_Score__c,a.Math_Score__c,a.Reading_Score__c,a.Science_Score__c,a.Composite_Score__c,a.exportSequence__c,a.Other_Score__c,a.SAT_II_Subject__c,a.SAT_II_Subject_Score__c,a.TOEFL_Speaking_Comprehension__c,a.TOEFL_Total_Score__c,a.TOEFL_Writing_Comprehension__c From t.Test__r a) from Application__c t Where Id In :lstids];

 

 

  • September 26, 2012
  • Like
  • 0

Hi Team.,

 

this my simple soql query.but my debug is not showing any thing related to contacts and cases.,

 

public class RelatedList{
    public static void subList(){
        List<Account> sam =[select id,name ,(Select email from contacts),(Select CaseNumber from cases) from account ];
         For(Account a :sam){
         System.debug('================values======'+a);
         }

    }

}

  • September 19, 2012
  • Like
  • 0

i serialized a list ino JSON String.,

 

I am using HTTP Post to send that json to other end.,

 

I need to handle special characters in my JSON string,

 

Please help me.,

  • December 10, 2012
  • Like
  • 0

Hi Team.,

 

I am NewBie trying to learn.,Any Help is appreciated.,

 

i have a custom field srmid__c in contact object,i am getting the json string as a response when i make a future callout.i need to update the srmid__c with this value.,

 

//Incoming JSON String: {"LocalDB_Key":5109740,"Salesforce_Key":"003Q000000ZsOynIAF","JRM_Object":"Contact","JRM_Field":"srmid__c"}


public class JSONParser {
public Integer LocalDB_Key {get;set;}
public String Salesforce_Key {get;set;}
public String JRM_Object {get;set;}
public String JRM_Field {get;set;}
Http h = new Http();
HttpRequest req = new HttpRequest();
String url = '******************************';
req.setMethod('POST');
req.setEndpoint(url);
req.setTimeout(120000);
HttpResponse res = h.send(req);
JSONParser parser = JSON.createParser(res.getBody());
while (parser.nextToken() != null) {
if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
String text = parser.getText();
parser.nextToken();
if (text == 'LocalDB_Key') {
this.LocalDB_Key = parser.getIntegerValue();
} else if (text == 'Salesforce_Key') {
this.Salesforce_Key = parser.getText();
} else if (text == 'JRM_Object') {
this.JRM_Object = parser.getText();
} else if (text == 'JRM_Field') {
this.JRM_Field = parser.getText();
}
}
}
}

  • October 17, 2012
  • Like
  • 0

i have two custom objects parent: test,child:Application

 

i want to send all test object fields for that specific application.,

 

The query i have

 

lsttest =[Select (Select a.English_Writing_Score__c,a.English_Score__c,a.Math_Score__c,a.Reading_Score__c,a.Science_Score__c,a.Composite_Score__c,a.exportSequence__c,a.Other_Score__c,a.SAT_II_Subject__c,a.SAT_II_Subject_Score__c,a.TOEFL_Speaking_Comprehension__c,a.TOEFL_Total_Score__c,a.TOEFL_Writing_Comprehension__c From t.Test__r a) from Application__c t Where Id In :lstids];

 

 

  • September 26, 2012
  • Like
  • 0

Hi Team.,

 

this my simple soql query.but my debug is not showing any thing related to contacts and cases.,

 

public class RelatedList{
    public static void subList(){
        List<Account> sam =[select id,name ,(Select email from contacts),(Select CaseNumber from cases) from account ];
         For(Account a :sam){
         System.debug('================values======'+a);
         }

    }

}

  • September 19, 2012
  • Like
  • 0

 

when i try to parse the string

 

 

with this code

             counter=0;
                while (parser.nextToken() != null && counter<10)
                {
                counter++;
                    if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'total_records'))
                     {
                     
                            // Get the value.
                                parser.nextToken();
                            // Compute the grand total price for all invoices.
                            Temp=parser.getText();
                            file_count=integer.valueof(Temp);
                            if(file_count==0)
                            {
                             file_exists=0;
                            
                             }
                           // csv_ids.add( Temp);
                      }
                }
                counter=0;
                 
my json string is

{"success":true,"total_records":1,"data":[{"file_name":"aaavalid.csv"}]}

 

 

 

 

Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,4]
An unexpected error has occurred. Your solution provider has been notified. (system)

How do i resolve this problem

Thanks in advance

punnoose