• KrForce
  • NEWBIE
  • 15 Points
  • Member since 2015
  • Salesforce Architect

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 11
    Replies
We have a roll-up summary field on the opportunity to Summarize opportunity line items list price after the discount and it's not calculating automatically until unless we edit and save all line items(Dummy Update).
Is there any worked around for this issue ?
Im trying get the selected recordtype into the controller to build additional rendering logic in showTranLog() method based on input selection but its always returning null. when i insert the record in saveproceed() method its getting set fine.
<apex:page standardController="Contact" extensions="TaskExtensionCtrl">

  <apex:form >
    <apex:pageBlock title="New Log" mode="edit" id='pb'>
    <apex:pageBlockSection id="selectedRecordType" columns="1">
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Choose Record Type" for="rt" />         
            <apex:panelGrid columns="2">
            <apex:selectList value="{!selectedrecType}" multiselect="false"  size="1" required="true">
                <apex:selectOptions value="{!rectypes}"/>
                <apex:actionSupport event="onchange" action="{!showTranLog}" reRender="pb" status="status" immediate="true"/>
            </apex:selectList> 
            </apex:panelGrid>       
        </apex:pageBlockSectionItem>
    </apex:pageBlockSection>
     <apex:pageBlockButtons location="bottom">
        <apex:commandButton value="Save" action="{!saveAndProceed}" />
      </apex:pageBlockButtons>
    </apex:pageBlock>
  </apex:form>
</apex:page>
 
Controller:

public with sharing class TaskExtensionCtrl {
    public String partId;
    public Task task {get;set;}
    public boolean isShowTranLog  {get;set;}{isShowTranLog=false;}
    public string selectedrecType{get;set;}

    public TaskExtensionCtrl(ApexPages.StandardController controller){
        partId=ApexPages.currentpage().getParameters().get('id');
        createTaskRecord();
    }

    public void createTaskRecord() {
        system.debug(LoggingLevel.error,'in creat task'+selectedrecType);
        task = new Task();
    }
    public PageReference showTranLog(){
          this.isShowTranLog = true;
          system.debug(LoggingLevel.error,'task record type in showTranLog#'+ task.RecordTypeID+Task);
          return null;
     }    
    public List<SelectOption> getrectypes() {

        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('','--Select Record Type --'));
        for(RecordType rt:[select id,name from RecordType where sobjecttype='task']){
            options.add(new SelectOption(rt.id,rt.name));    
        }
        return options;
    }

    public String getselectedrecType() {
        return selectedrecType;
    }

    public void setselectedrecType(String selectedrecType) {
        this.selectedrecType= selectedrecType;
    }


 
  • September 23, 2015
  • Like
  • 0
Hi,
my goal is to keep only one contact TAB opened in Console all the time , if there is already a tab opened i need to close it and open the new tab.

I have a VF section on standard detail page and i added addEventListener for OPEN_TAB. When the EventListener function executes on TAB open getting the error saying un supported API function. does it means i can't add EventListener on a VF section? if so is there in other work around for this?

function getAllTabIds() {
// get all Tab ID's
sforce.console.getEnclosingPrimaryTabIds(closeAlltabs);
}
var closeAlltabs = function closeAlltabs(results) {
alert('closeAlltabs Called'+result.ids);
var tabId = result.id;
};
sforce.console.addEventListener(sforce.console.ConsoleEvent.OPEN_TAB, getAllTabIds, { tabId : sforce.console.getEnclosingTabId() });
  • September 11, 2015
  • Like
  • 0
Hi ,
Can some one please to add the space before FROM in Dynamic SOQL.
string query ='SELECT ' + qFields +
                       'FROM contact'+
                       ' WHERE user_num__c = \'' + String.escapeSingleQuotes(uNum) + '\''+
                       ' LIMIT 1';
  • September 08, 2015
  • Like
  • 0
Hi,

I want to refreshrefresh primary tab after 5 secs of any adjacent tab close. With will below clode immediate refresh works fine, my goal is to add a delay for 5 secs and then refresh. Any suggestions?
 
sforce.console.addEventListener(sforce.console.ConsoleEvent.CLOSE_TAB, refresh); 
    function refresh() {
    alert('Refresh successfull');
    var tabId = 'scc-pt-0';
    //sforce.console.refreshPrimaryTabById(tabId);
    setTimeout(function(){ 
    sforce.console.refreshPrimaryTabById(tabId); }, 5000);
    }


 
How to define id:String in sforce.console.openPrimaryTab instead of null in salesforce? here is the code that im using,

and im getting openPrimaryTab: Invalid ID: error. any help?

function OpenTab() {
      sforce.console.openPrimaryTab('{!contact.ID}', '/apex/contactPage?scontrolCaching=1&id={!contact.ID}', true,'contact');
}
Here is REST handler.

@RestResource(urlMapping='/UpdateContact/*')
global with sharing class REST_ParticipantHandler {
  
    @HttpPost
    global static void updateParticipant() {
        
        //rest context variable initialization.
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        //utill class returns fieldmap from the custom setings
        Map<String,String> FieldMap=util.getFieldMap();
        Map<String,String> FieldTypeMap=util.getFieldTypeMap();
        Map<String, Object> jsonBodyMap = (Map<String, Object>)JSON.deserializeUntyped(req.requestBody.toString());
        Blob body = req.requestBody;
        String bodyString = body.toString();
        Wrapclass deserializedinput = (Wrapclass)JSON.deserialize(bodyString, Wrapclass.class);
        Map<String, Object> jsonBodyMapLcase = new Map<String, Object>();
        string qFields=String.join(FieldMap.values(), ', ');
        string uNum=''; 
        String sf_jsonResponse = '';
        //converting jSON body map keys into lowercase to handle casesensitity issues.
        for( string s1:jsonBodyMap.keySet()){
            jsonBodyMapLcase.put(s1.toLowerCase(),String.valueOf((String)jsonBodyMap.get(s1)));
            system.debug(LoggingLevel.error,'jsonBodyMap#'+s1+'='+String.valueOf((String)jsonBodyMap.get(s1)));
        }
        
        //getting the userNum from Jsonbody to instantiate corresponding participant record.
        if(!string.IsBlank((String)jsonBodyMap.get('userNum'))){
            uNum = !string.IsBlank((String)jsonBodyMap.get('userNum'))?String.valueOf((String)jsonBodyMap.get('userNum')):'';
        }
        
        system.debug(LoggingLevel.error,'uNum#'+uNum);
        system.debug(LoggingLevel.error,'jsonBodyMap#'+jsonBodyMap);
        // No userNum parameter was found; return status 400
        if(uNum == null) {
            res.statusCode = 400;
            sf_jsonResponse = '{"response": {"status": "Failure", "message": "MissingRequiredQueryParameter userNum"}}';
            res.responseBody = blob.valueOf(sf_jsonResponse);
            return;
        }
        //Dynamic query to query the object dynamically with all the fields.
        string query ='SELECT ' + qFields
                       + ' FROM contact'
                       + ' WHERE user_num__c = \'' + String.escapeSingleQuotes(uNum) + '\''
                       + ' LIMIT 1';
        system.debug(LoggingLevel.error,'query#'+query);
        List<Contact> parts=Database.query(query);
        // No Participants with matching userNum
        if( parts.size()<=0) {
            res.statusCode = 400;
            sf_jsonResponse = '{"response": {"status": "Failure", "message": "No matching Participant record:'+uNum+' ' +'found with this userNum"}}';
            res.responseBody = blob.valueOf(sf_jsonResponse);
            return;
        }
        //participant Instance
        contact p=parts.get(0);
        
        for(String pfield:FieldMap.keySet()){
            
            if(!string.IsBlank((String)jsonBodyMapLcase.get(pfield))){
                
                if('Text'==FieldTypeMap.get(pfield))    {
                    p.put(FieldMap.get(pfield),String.valueOf((String)jsonBodyMapLcase.get(pfield)));}
                
                else if('Currency'==FieldTypeMap.get(pfield)){
                    p.put(FieldMap.get(pfield),Decimal.valueOf((String)jsonBodyMapLcase.get(pfield)));}
                
                else if('Number'==FieldTypeMap.get(pfield))  {
                    p.put(FieldMap.get(pfield),Integer.valueOf((String)jsonBodyMapLcase.get(pfield)));}
                
                else if('Date'==FieldTypeMap.get(pfield))    {
                    system.debug(LoggingLevel.error,'Field=' + FieldMap.get(pfield));
                    //Data coming as a string value with '-' seprator and salesfore wont accept the string to date field. needs to convert string to salesforce date formate.
                    string sDate=string.valueOf((String)jsonBodyMapLcase.get(pfield));
                    system.debug(LoggingLevel.error,'sDate**=' + sDate);
                    //date d =util.getDateSfFormate(sdate);
                    String[] myDateOnly = sDate.split(' ');
                    String[] strDate = myDateOnly[0].split('-');
                    Integer myIntYear = integer.valueOf(strDate[0]);
                    Integer myIntMonth = integer.valueOf(strDate[1]);
                    Integer myIntDate = integer.valueOf(strDate[2]);
                    Date dt= Date.newInstance(myIntYear, myIntMonth, myIntDate);
                    system.debug(LoggingLevel.error,'dt**=' + dt);
                    p.put(FieldMap.get(pfield),dt);}
                else if('Checkbox'==FieldTypeMap.get(pfield)){
                    if(String.valueOf((String)jsonBodyMapLcase.get(pfield))=='1'){
                        p.put(FieldMap.get(pfield),True);} 
                    else {
                        p.put(FieldMap.get(pfield),False);}
                }
            }
            else{
                p.put(FieldMap.get(pfield),null);}
        }
        system.debug(LoggingLevel.error,'updated Participant=' + p);
            
        try {
            res.statusCode = 200;
            update p;
            sf_jsonResponse = '{"response": {"status": "Sucess", "message": "Participant record:'+uNum +' ' +'is updated in Salesforce"}}';
            res.responseBody = blob.valueOf(sf_jsonResponse);
            return;
        } catch ( Exception ex ) {
            res.statusCode = 500;
            sf_jsonResponse = '{"response": {"status": "Failure", "message": "Participant record:'+uNum +' '+ ex + '"}}';
            res.responseBody = blob.valueOf(sf_jsonResponse);
            return;
        }
        
    }
     global class Wrapclass {
        public String status;
        public String responseBody;
        
    }
    
}

Here is my Test class..

@isTest(seeAllData=false)
Public class Test_RESTParticipantHandler {

    public static testMethod void testdoPost() {
        
        System.RestContext.request = new RestRequest();
        System.RestContext.response = new RestResponse();
        
        Account a = new Account(Name = 'Test', RK_ID__c='106',PR_FE_Branded__c= true);
        insert a;
        String orgId=a.id;
        
        Contact c = new Contact();
    
        c.firstname = 'Wain';
        c.lastname = 'R';
        c.AccountId = orgId;
        c.email = 'Wain@test.com';
        c.phone = '6884382997';
        c.mailingstreet = '123 Test Ave';
        c.mailingcity = 'Somewhere';
        c.mailingstate = 'MA';
        c.mailingPostalCode = '87945';
        c.mailingcountry = 'US';
        c.User_Num__c='1234567';
        insert(c);
        
        RestRequest req = new RestRequest(); 
        RestResponse res = new RestResponse();
        
        REST_ParticipantHandler.Wrapclass reqst=new REST_ParticipantHandler.Wrapclass();
        reqst.status= 'Success';
        reqst.responseBody ='{"state":"CA","riskTolerance":"Typical for your age","retirementAge":"70",alPortfolio":"65627.50","phoneContactPreference":"SEC Required Only","email":"","homePhone":"5555555555","title":"","mailingAddress":"13630 SE 231ST ST","userNum":"13328911","lastInitial":"R","city":"Sunnyvale","zip":"94086","foreignResident":"0","workPhone":"4084986934","otherPhone":"5555555555",","isFeBrand":"1","primaryAccountPlan":"Voluntary Investment Plan (VIP)","convertedFromUserNum":"","convertedToUserNum":"","countryCode":"US"}';
        String JsonMsg=JSON.serialize(reqst);

        req.requestURI ='/services/apexrest/UpdateParticipant'; 
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
        RestContext.response= res;
        RestContext.request = req;
        REST_ParticipantHandler.UpdateParticipant();
        
        //System.assertEquals('true', results.success);
        //System.assertEquals(10, results.records.size());
        
      }
}

*****************************************************************
Im getting an error "System.QueryException: unexpected token: 'FROM'" 
**********************************************************************
using "sforce.console.openPrimaryTab" im opening a new primary tab in console and its a opeing a tab successfully. but i want to navigate automatically to new primary tab. is it doable in the console?

here is my code snippet.

<apex:page standardController="contact" extensions="XXXX" standardStylesheets="false">

<apex:includeScript value="/support/console/31.0/integration.js"/>
<script type="text/javascript">
 function OpenClientViewTab() {
 //Open a new primary tab with the ClientView home page in it
  sforce.console.openPrimaryTab(null, '/apex/CanvasAppPage?scontrolCaching=1&id={!contact.ID}', false,'ClientView', openSuccess, 'salesforceTab');
  }
</script>
  
<apex:form id="myform"> 
<apex:pageblock >  
<apex:pageBlockButtons location="Top"> 
<apex:commandButton value="Client View" onclick="OpenClientViewTab();return false"  styleClass="buttonStyle" style="background:LightBlue;width:80px;float:Center;" /> 
</apex:pageBlockButtons> 
<apex:pageMessages id="msgs"/>
</apex:pageblock> 
</apex:form>
</apex:page>
​We have salesforce connected to SAML SSO(OKTA) and OKTA is IDP for salesforce.

We have a Java legacy system which provides a Web service and it is also part of SSO. Legacy application expects SAML response to get in.

now, in my case how do we handle the SSO for server to server Call outs?

Thank you in Advance.
The scenario is we wanted is to integrate the extenal webapp within salesforce. for some business reasons/security of the data we are keeping the activie session for too long in external webapp. My challenge is when user closes the browser i need to terminate the session . is it possible in salesforce ? 
​We have salesforce connected to SAML SSO(OKTA) and OKTA is IDP for salesforce.

We have a Java legacy system which provides a Web service and it is also part of SSO. Legacy application expects SAML response to get in.

now, in my case how do we handle the SSO for server to server Call outs?

Thank you in Advance.
Hi ,
Can some one please to add the space before FROM in Dynamic SOQL.
string query ='SELECT ' + qFields +
                       'FROM contact'+
                       ' WHERE user_num__c = \'' + String.escapeSingleQuotes(uNum) + '\''+
                       ' LIMIT 1';
  • September 08, 2015
  • Like
  • 0
Here is REST handler.

@RestResource(urlMapping='/UpdateContact/*')
global with sharing class REST_ParticipantHandler {
  
    @HttpPost
    global static void updateParticipant() {
        
        //rest context variable initialization.
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        //utill class returns fieldmap from the custom setings
        Map<String,String> FieldMap=util.getFieldMap();
        Map<String,String> FieldTypeMap=util.getFieldTypeMap();
        Map<String, Object> jsonBodyMap = (Map<String, Object>)JSON.deserializeUntyped(req.requestBody.toString());
        Blob body = req.requestBody;
        String bodyString = body.toString();
        Wrapclass deserializedinput = (Wrapclass)JSON.deserialize(bodyString, Wrapclass.class);
        Map<String, Object> jsonBodyMapLcase = new Map<String, Object>();
        string qFields=String.join(FieldMap.values(), ', ');
        string uNum=''; 
        String sf_jsonResponse = '';
        //converting jSON body map keys into lowercase to handle casesensitity issues.
        for( string s1:jsonBodyMap.keySet()){
            jsonBodyMapLcase.put(s1.toLowerCase(),String.valueOf((String)jsonBodyMap.get(s1)));
            system.debug(LoggingLevel.error,'jsonBodyMap#'+s1+'='+String.valueOf((String)jsonBodyMap.get(s1)));
        }
        
        //getting the userNum from Jsonbody to instantiate corresponding participant record.
        if(!string.IsBlank((String)jsonBodyMap.get('userNum'))){
            uNum = !string.IsBlank((String)jsonBodyMap.get('userNum'))?String.valueOf((String)jsonBodyMap.get('userNum')):'';
        }
        
        system.debug(LoggingLevel.error,'uNum#'+uNum);
        system.debug(LoggingLevel.error,'jsonBodyMap#'+jsonBodyMap);
        // No userNum parameter was found; return status 400
        if(uNum == null) {
            res.statusCode = 400;
            sf_jsonResponse = '{"response": {"status": "Failure", "message": "MissingRequiredQueryParameter userNum"}}';
            res.responseBody = blob.valueOf(sf_jsonResponse);
            return;
        }
        //Dynamic query to query the object dynamically with all the fields.
        string query ='SELECT ' + qFields
                       + ' FROM contact'
                       + ' WHERE user_num__c = \'' + String.escapeSingleQuotes(uNum) + '\''
                       + ' LIMIT 1';
        system.debug(LoggingLevel.error,'query#'+query);
        List<Contact> parts=Database.query(query);
        // No Participants with matching userNum
        if( parts.size()<=0) {
            res.statusCode = 400;
            sf_jsonResponse = '{"response": {"status": "Failure", "message": "No matching Participant record:'+uNum+' ' +'found with this userNum"}}';
            res.responseBody = blob.valueOf(sf_jsonResponse);
            return;
        }
        //participant Instance
        contact p=parts.get(0);
        
        for(String pfield:FieldMap.keySet()){
            
            if(!string.IsBlank((String)jsonBodyMapLcase.get(pfield))){
                
                if('Text'==FieldTypeMap.get(pfield))    {
                    p.put(FieldMap.get(pfield),String.valueOf((String)jsonBodyMapLcase.get(pfield)));}
                
                else if('Currency'==FieldTypeMap.get(pfield)){
                    p.put(FieldMap.get(pfield),Decimal.valueOf((String)jsonBodyMapLcase.get(pfield)));}
                
                else if('Number'==FieldTypeMap.get(pfield))  {
                    p.put(FieldMap.get(pfield),Integer.valueOf((String)jsonBodyMapLcase.get(pfield)));}
                
                else if('Date'==FieldTypeMap.get(pfield))    {
                    system.debug(LoggingLevel.error,'Field=' + FieldMap.get(pfield));
                    //Data coming as a string value with '-' seprator and salesfore wont accept the string to date field. needs to convert string to salesforce date formate.
                    string sDate=string.valueOf((String)jsonBodyMapLcase.get(pfield));
                    system.debug(LoggingLevel.error,'sDate**=' + sDate);
                    //date d =util.getDateSfFormate(sdate);
                    String[] myDateOnly = sDate.split(' ');
                    String[] strDate = myDateOnly[0].split('-');
                    Integer myIntYear = integer.valueOf(strDate[0]);
                    Integer myIntMonth = integer.valueOf(strDate[1]);
                    Integer myIntDate = integer.valueOf(strDate[2]);
                    Date dt= Date.newInstance(myIntYear, myIntMonth, myIntDate);
                    system.debug(LoggingLevel.error,'dt**=' + dt);
                    p.put(FieldMap.get(pfield),dt);}
                else if('Checkbox'==FieldTypeMap.get(pfield)){
                    if(String.valueOf((String)jsonBodyMapLcase.get(pfield))=='1'){
                        p.put(FieldMap.get(pfield),True);} 
                    else {
                        p.put(FieldMap.get(pfield),False);}
                }
            }
            else{
                p.put(FieldMap.get(pfield),null);}
        }
        system.debug(LoggingLevel.error,'updated Participant=' + p);
            
        try {
            res.statusCode = 200;
            update p;
            sf_jsonResponse = '{"response": {"status": "Sucess", "message": "Participant record:'+uNum +' ' +'is updated in Salesforce"}}';
            res.responseBody = blob.valueOf(sf_jsonResponse);
            return;
        } catch ( Exception ex ) {
            res.statusCode = 500;
            sf_jsonResponse = '{"response": {"status": "Failure", "message": "Participant record:'+uNum +' '+ ex + '"}}';
            res.responseBody = blob.valueOf(sf_jsonResponse);
            return;
        }
        
    }
     global class Wrapclass {
        public String status;
        public String responseBody;
        
    }
    
}

Here is my Test class..

@isTest(seeAllData=false)
Public class Test_RESTParticipantHandler {

    public static testMethod void testdoPost() {
        
        System.RestContext.request = new RestRequest();
        System.RestContext.response = new RestResponse();
        
        Account a = new Account(Name = 'Test', RK_ID__c='106',PR_FE_Branded__c= true);
        insert a;
        String orgId=a.id;
        
        Contact c = new Contact();
    
        c.firstname = 'Wain';
        c.lastname = 'R';
        c.AccountId = orgId;
        c.email = 'Wain@test.com';
        c.phone = '6884382997';
        c.mailingstreet = '123 Test Ave';
        c.mailingcity = 'Somewhere';
        c.mailingstate = 'MA';
        c.mailingPostalCode = '87945';
        c.mailingcountry = 'US';
        c.User_Num__c='1234567';
        insert(c);
        
        RestRequest req = new RestRequest(); 
        RestResponse res = new RestResponse();
        
        REST_ParticipantHandler.Wrapclass reqst=new REST_ParticipantHandler.Wrapclass();
        reqst.status= 'Success';
        reqst.responseBody ='{"state":"CA","riskTolerance":"Typical for your age","retirementAge":"70",alPortfolio":"65627.50","phoneContactPreference":"SEC Required Only","email":"","homePhone":"5555555555","title":"","mailingAddress":"13630 SE 231ST ST","userNum":"13328911","lastInitial":"R","city":"Sunnyvale","zip":"94086","foreignResident":"0","workPhone":"4084986934","otherPhone":"5555555555",","isFeBrand":"1","primaryAccountPlan":"Voluntary Investment Plan (VIP)","convertedFromUserNum":"","convertedToUserNum":"","countryCode":"US"}';
        String JsonMsg=JSON.serialize(reqst);

        req.requestURI ='/services/apexrest/UpdateParticipant'; 
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
        RestContext.response= res;
        RestContext.request = req;
        REST_ParticipantHandler.UpdateParticipant();
        
        //System.assertEquals('true', results.success);
        //System.assertEquals(10, results.records.size());
        
      }
}

*****************************************************************
Im getting an error "System.QueryException: unexpected token: 'FROM'" 
**********************************************************************
using "sforce.console.openPrimaryTab" im opening a new primary tab in console and its a opeing a tab successfully. but i want to navigate automatically to new primary tab. is it doable in the console?

here is my code snippet.

<apex:page standardController="contact" extensions="XXXX" standardStylesheets="false">

<apex:includeScript value="/support/console/31.0/integration.js"/>
<script type="text/javascript">
 function OpenClientViewTab() {
 //Open a new primary tab with the ClientView home page in it
  sforce.console.openPrimaryTab(null, '/apex/CanvasAppPage?scontrolCaching=1&id={!contact.ID}', false,'ClientView', openSuccess, 'salesforceTab');
  }
</script>
  
<apex:form id="myform"> 
<apex:pageblock >  
<apex:pageBlockButtons location="Top"> 
<apex:commandButton value="Client View" onclick="OpenClientViewTab();return false"  styleClass="buttonStyle" style="background:LightBlue;width:80px;float:Center;" /> 
</apex:pageBlockButtons> 
<apex:pageMessages id="msgs"/>
</apex:pageblock> 
</apex:form>
</apex:page>
Hi All, 
I am trying to connect to external webservice. I am using Jeff Dougloas blog as referencehttp://blog.jeffdouglas.com/2009/03/16/restful-web-service-callout-using-post/

I created a new remote site.
Below is the class:
public class WebServiceCallout {

    //@future (callout=true)
    public static void sendNotification(String territories, String searchText) {

        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();

        req.setEndpoint('https://pelcosales.schneider-electric.com/Administration/SalesForceServices');
        req.setMethod('POST');
        req.setBody('territories='+EncodingUtil.urlEncode(territories, 'UTF-8')+'&searchText='+EncodingUtil.urlEncode(searchText, 'UTF-8'));
        //req.setCompressed(true); // otherwise we hit a limit of 32000

        try {
            res = http.send(req);
            System.debug(res.toString());
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(res.toString());
        }

    }

    // run WebServiceCallout.testMe(); from Execute Anonymous to test
    /*public static testMethod void testMe() {
        WebServiceCallout.sendNotification('My Test Customer','My City');
    }*/

}

I am executing it by running following code in Execute Anonymous Window
WebServiceCallout.sendNotification('17','360 Advanced Security Corporation');
I am getting error message :
15:36:13:427 USER_DEBUG [17]|DEBUG|System.HttpResponse[Status=Not Found, StatusCode=404]

I would appreciate any help.
 
The scenario is we wanted is to integrate the extenal webapp within salesforce. for some business reasons/security of the data we are keeping the activie session for too long in external webapp. My challenge is when user closes the browser i need to terminate the session . is it possible in salesforce ? 
Hi EVeryone,

Stumped on why i keep getting the following error when testing my code block: System.NullPointerException: Attempt to de-reference a null object
I understand the reason for the error, but cannot seem to figure out why the code is throwing it. the Feedback object should be initialized and be able to be added to the feedbackList.

Appreciate the help!
 
String d = 'a0G190000015uMg'; //for testing

//containers for querys
Deliverable__c deliverable;
List<Feedback_Survey_Question__c> questionList;
List<Feedback_Responses__c> responseList;
List<Feedback__c> feedbackList;
List<Approver__c> approverList;

//query db for lists
deliverable = [SELECT id, type__c, milestone__c, Number_of_Concepts__c, Status__c FROM Deliverable__c WHERE id = :d];
approverList = [SELECT id, name, Approver__c, Approver_Role__c FROM Approver__c WHERE Deliverable__r.id = :d];
//assign pieces of delvierable

decimal concepts = deliverable.Number_of_Concepts__c;
string milestone = deliverable.milestone__c;

System.debug(deliverable);
System.debug(concepts);
System.debug(milestone);

for (Integer i = 1; i <= concepts; i++){ 
    for (Approver__c a : approverList) { 
    
    String role = a.Approver_Role__c;
    String aid = a.id;
    
    Feedback__c Feedback = new Feedback__c();
    Feedback.Name = 'Concept ' + i;
    Feedback.Deliverable__c = d;
    Feedback.Approver__c = aid;
    feedbackList.add(Feedback); //ERROR BEING THROWN HERE
    
    }
    
}


 
I created a couple of javascript functions for managing the number
of open tabs inside the service cloud console. I am using addEventListener
for the OPEN_TAB and CLOSE_TAB console events to trigger these functions.

I was also assuming clicking the "+" button for explicitly opening a new tab as well
as closing it would also trigger my functions. The function associated with the
OPEN_TAB was NOT triggered, but the function associated with the CLOSE_TAB
DID get triggered. Not sure why.

I am using the integration.js library, version 30. I tried 31, but it wasn't working
for some reason.

Any help would be appreciated. Thanks, Chris

This is a ridiculously simple question and just involves date formatting.  Hoping one of the brains on here can figure this out before I do.

 

I just want to add 1 year to the current year.

 

So if I've got

 

DateTime dt=System.now();
String str=dt.format('yyyy');

 

I just want to add 1 year to that string, so I can refer to it in my code.  That's it.

 

This has got to be super easy I just am too dumb to see it yet.

 

Thanks guys

  • March 22, 2013
  • Like
  • 0