• sasham
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 36
    Replies
Hi , 
We have  Member__c obj and MemberState__C objects..MemberState__C  has look up field for Member__c obj. I need to create formula field in Member__c obj. In  MemberState__C obj , we having field state__c and date__c  When the member is active very first time(since we many active state) ,
i need to popolate the formula field called startdate__c  in Member__c using  date__c  in  MemberState__C when state__c is active.. But we can have many active states in  MemberState__C obj per member 
which site is best to create random key (api key and token )
  • April 18, 2018
  • Like
  • 0
If we have field to an SF table and an MC Data Extension, Is it possible to create apex or any script (from salesforce) that catches updates to the field in the SF table and propagates that update to the same field in the MC Data Extension? 
  • April 12, 2018
  • Like
  • 0
Hi . 
I need to update the owner field in a custom object  when a custom field(which has look up to user) changes . I need to check when inserting and updating if the field has value and it is changed , then i need to update owner filed with the value. 

Object : Registration 
custome field : Adviser - look up to user 

need to chnage the owner field in the Registration obj with adviser field.

1)Having a  problem if that before update or after update trigger. 
If  I write after update trigger . I am  wondering if the trigger will run again and again. It will be a recursion. Pls help on this 
  • March 23, 2018
  • Like
  • 0
I need to make a REST callout. I have more than 400 records at time( after bulk insert (more than 400 records ) and  then  need to make callout for sending each record to external sytem)  .
Please guide whcih approach is better to follow
Create a batch and make callouts from the batch (scope is 1)
Or 
Create trigger and then excecute the queueable apex to make callout 
  • February 27, 2018
  • Like
  • 0
I have to  make callout from salesforce to external sysytem. need to send a file as xml (request body to POSt method) 
And i have object for this and all the fields i am querying from this object called  Clientdetails. not sute how to convert as xml fil for Rest service 
<message>
<data>
<result>
<order_code>8798</order_code>
<result_code>pp</result_code>
<units>pp</units>
<value>3</value>
<reference>2-4</reference>
<date>2017-12-14</date>
<normalcy>N</normalcy>
<facility>OO\^Example Labs MMD\^26901 Rod Hills Road\^Calabasas Hills\^CA\^91301\^Dr. Test, MD</facility>
</result>
<result>
<order_code>8798</order_code>
<result_code>pp</result_code>
<units>pp</units>
<value>3</value>
<reference>2-4</reference>
<date>2017-12-14</date>
<normalcy>N</normalcy>
<facility>99\^Example Service MMD\^26901 Rod Hills Road\^Calabasas Hills\^CA\^91301\^Dr. Test, MD</facility>
</result>

</data>
</message>
 
  • February 05, 2018
  • Like
  • 0
It is in Curl for makign Api calout for post method 

curl -H 'Accept: application/xml' -H 'Content-Type:application/xml' \
-u api_key:api_token -d '<message><data><result>
<id>123</id>
<address>cc</address>
<value>5</value>
</result></data></hl7message>'\
'https://example.com/customers/2342/messages

But How do make callout in Apex calss forthe above 
Specially for authentication  -u api_key:api_token
I have api key and token 
  • January 17, 2018
  • Like
  • 0
our client is supposed to send us notification after the resuts has been reviewd. 
1) approval notification 
2)Results  are  availble
these are the urls they asked me to  set up in our end 
http://example.com/notif?id={id}&status=approved
http://example.com/notif?id={id}&status=resulted[&result_type={result}]

For that . I need to setup up an apex class as a REST endpoint for an HTTP GET request that an external system is sending notification.
Please le me know is the right way do or please guide me 
@RestResource(urlMapping='/sample/approvalnotifications')
global without sharing class  Rest_Approval_Notification {

    
    @HttpGet
    global static void doGet() {
        
        System.debug(RestContext.request.requestBody);
        restresponse res=restcontext.response;
        String notification_id = RestContext.request.params.get('id');
        String notification_status = RestContext.request.params.get('status');
        System.debug(notification_id);
        System.debug(notification_status);
		
		//hadling error code and logic for processing 
        
        
        
    }
        
}

 


 
  • January 12, 2018
  • Like
  • 0
I have set up 2  apex class as a REST endpoint for an HTTP GET request that an external system is sending for 2 notification 
such as approved  and result available
http://example.com/notif?id={id}&status=approved
 http://example.com/notif?id={id}&status=resulted[&result_type={result}]
for authentication , we have 3 options 
IP Based Authentication
Token Based Authentication
HTTP Basic Authentication.
Could please  anyone answer , is Token Based Authentication is OAuth  authetication  and how to setup the Token Based Authentication
  • January 11, 2018
  • Like
  • 0
Could you pls some let me know the futue method can be used inside scheduer for long running process 
  • December 18, 2017
  • Like
  • 0
i need to  select  two dates from visualforce page (calender )  after cliciking on the button , in apex controller i need to use those two dates for createddate in the quer
for example if i select 1/20/2017 and 2/20/207  as dates in my page , the query need to retrive data between those two dates in apex controller 
  • December 12, 2017
  • Like
  • 0
how batch apex will handle this situation. we have more than 2000 paticipants in participant objects and steps and weight object
we need a job to handle everyday to find the highst step amonght participant for ranking and to find most hightest step for participant for specific period of time.
if i set chuck to 1 . how all all the particpant steps can be compared.
 
  • December 07, 2017
  • Like
  • 0
Hi 
I have scheduled scheduler class everyday at 1pm(through UI). It seems to be woeking in my staging sanbox. but when i see in the apex job . it is status as queued  and  it should have one staus at 1pm as completed if it was woring at 1 pm.  but as queued.
but i production i can see the status as failed and  staus detail as Scheduler: failed to execute scheduled job: jobId:456778999X class: common.apex.async.AsyncApexJobObject, reason: Apex CPU time limit exceeded.
My question  is It failed in production because cpu time exceeded but in staging why there isno staus as completed or failed but looks like it is working.

 
  • December 03, 2017
  • Like
  • 0
Hi 

We have custom Participant object and custom timezone field(pick list - cetral , eastern arizona and pacific ). for each particiipat , particiipant address (state and zip code) is stored in child object called participantdetail. 
when new participnat is created , how do i populate the time zone  field with thier timezone ( i have  the zip code in address  and is it possible to populate the timezone field using the zip code  ) or any other way.  . 
  • November 14, 2017
  • Like
  • 0
It works in prodction but not in sanbox (acsess token is not required)
  • November 08, 2017
  • Like
  • 0
How do i access Api (public rest api , no need acsess token ) form postmen or runscope. but i woks in workbench 
It showing an error  invalid session id . It works in production not in sanbox 
  • November 07, 2017
  • Like
  • 1
I have craeted custom Rest Api (post method and get ) . Pls let me know if that Api can be called from marketting cloud and how (using java script)
  • November 01, 2017
  • Like
  • 0
  • October 31, 2017
  • Like
  • 0
 I have some questions and clarification. This code is used using Vf page and button . when i click on the button it will update the states We have huge participants in the system . i am querying all the participants , states and Reviews in my code. pls let me know it will not throw an error in regards to governor limit if that so , how do i change and what to do for that ( i used map for that ) still confusing Pls answer if it is possible
public PageReference insertstates(

String statesRec = assessed;
String quiz= '123'
PsRecsById = new Map<id, States__c>();
recsById =  new Map<id, (participant__c> ();
         for(States__c st : [select Id,participant__c,state_c
                                         from  States__c
                                           where participant__c!=null and State__c=:statesRec])
             {
                PsRecsById .put(st.participant__c, st);
                 
             }
         stateIds = new Set<ID>();
         stateIds= PsRecsById .keyset();
         
        
         reviewtRecsById.put= new Map<Decimal, Review_C>(); 
         for(Review_C  assrecs : [select Id, RL_C,Quiz_C,CreatedDate from  Review_C where  Quiz_C=:quiz])
             {
                reviewtRecsById.put((Decimal)assrecs.RL_C, assrecs);
                 
             } 
         
          List<States__c> insertList = new List <States__c>();
         
         for(participant__c par :[select id,RL_C from participant__c where RL_C =:reviewtRecsById.keySet()])
             {
               // recsById.put(par.id, par);
                if(!stateIds.contains(par.ID))
                {
                     States__c stateObj = new States__c();
                     stateObj.participant__c = par.Id;
                     stateObj.State__c =statesRec.id;                  
                     stateObj.ReceivedAt_C=reviewRecsById.get(par.RL_C ).CreatedDate;
                     insertList.add(stateObj);
                }
             }
         if(insertList.size()>0)
         {
             insert insertList;
         }
      
return null; 
}

 
  • October 25, 2017
  • Like
  • 0
two objects - participant and State
Participant  -  Participantt_c 
State - Participantt_c (look up field), states( picklist as egistered and assesesd)
queriyng all participants whch match the id  from  other object (assesment)  and get craeted date form assesment
and then  see if there is  a state  as assesed for ecah participant from state table using those ids  , if not need to insert one 
I am trying to use the map to get participant id which match from assesment object and get the craeted date from assesment 
I m confusing using map 
  • October 23, 2017
  • Like
  • 0
How do i access Api (public rest api , no need acsess token ) form postmen or runscope. but i woks in workbench 
It showing an error  invalid session id . It works in production not in sanbox 
  • November 07, 2017
  • Like
  • 1
Hi , 
We have  Member__c obj and MemberState__C objects..MemberState__C  has look up field for Member__c obj. I need to create formula field in Member__c obj. In  MemberState__C obj , we having field state__c and date__c  When the member is active very first time(since we many active state) ,
i need to popolate the formula field called startdate__c  in Member__c using  date__c  in  MemberState__C when state__c is active.. But we can have many active states in  MemberState__C obj per member 
I need to make a REST callout. I have more than 400 records at time( after bulk insert (more than 400 records ) and  then  need to make callout for sending each record to external sytem)  .
Please guide whcih approach is better to follow
Create a batch and make callouts from the batch (scope is 1)
Or 
Create trigger and then excecute the queueable apex to make callout 
  • February 27, 2018
  • Like
  • 0
It is in Curl for makign Api calout for post method 

curl -H 'Accept: application/xml' -H 'Content-Type:application/xml' \
-u api_key:api_token -d '<message><data><result>
<id>123</id>
<address>cc</address>
<value>5</value>
</result></data></hl7message>'\
'https://example.com/customers/2342/messages

But How do make callout in Apex calss forthe above 
Specially for authentication  -u api_key:api_token
I have api key and token 
  • January 17, 2018
  • Like
  • 0
our client is supposed to send us notification after the resuts has been reviewd. 
1) approval notification 
2)Results  are  availble
these are the urls they asked me to  set up in our end 
http://example.com/notif?id={id}&status=approved
http://example.com/notif?id={id}&status=resulted[&result_type={result}]

For that . I need to setup up an apex class as a REST endpoint for an HTTP GET request that an external system is sending notification.
Please le me know is the right way do or please guide me 
@RestResource(urlMapping='/sample/approvalnotifications')
global without sharing class  Rest_Approval_Notification {

    
    @HttpGet
    global static void doGet() {
        
        System.debug(RestContext.request.requestBody);
        restresponse res=restcontext.response;
        String notification_id = RestContext.request.params.get('id');
        String notification_status = RestContext.request.params.get('status');
        System.debug(notification_id);
        System.debug(notification_status);
		
		//hadling error code and logic for processing 
        
        
        
    }
        
}

 


 
  • January 12, 2018
  • Like
  • 0
how batch apex will handle this situation. we have more than 2000 paticipants in participant objects and steps and weight object
we need a job to handle everyday to find the highst step amonght participant for ranking and to find most hightest step for participant for specific period of time.
if i set chuck to 1 . how all all the particpant steps can be compared.
 
  • December 07, 2017
  • Like
  • 0
Hi 

We have custom Participant object and custom timezone field(pick list - cetral , eastern arizona and pacific ). for each particiipat , particiipant address (state and zip code) is stored in child object called participantdetail. 
when new participnat is created , how do i populate the time zone  field with thier timezone ( i have  the zip code in address  and is it possible to populate the timezone field using the zip code  ) or any other way.  . 
  • November 14, 2017
  • Like
  • 0
It works in prodction but not in sanbox (acsess token is not required)
  • November 08, 2017
  • Like
  • 0
How do i access Api (public rest api , no need acsess token ) form postmen or runscope. but i woks in workbench 
It showing an error  invalid session id . It works in production not in sanbox 
  • November 07, 2017
  • Like
  • 1
I have all participant and states object (two records registered and assessed ). for some participant is not assesed inthe table evethough it is actually assessed. need to insert those records to states as assesesd 

i have list of patticipant ids and list of  states as assessed 

 if(recs.size()>0 && participantsatates.size()>0) 
         {
              for(participant__c p:recs)
                 {
             
                     for(States__c pstate :participantsatates)
                         
                         {
                            IF (P.Id = pstate.Participant__c)
                            {
                                
                                
                            }
                             
                 
                         }
                 }
  • October 23, 2017
  • Like
  • 0
Could ypu pls someone explain 
How to determine for tye first time login thorough moble  salesforce app which is developeed usiing mobile sdk native app (from ios or android).  Is there any field that we can identify if user (customers)logged in for the first time even if they are changing device or deleting the app and downloading again on their device.
  • September 19, 2017
  • Like
  • 0
Test method  for Scheduler Apex code  shows this exception in procution  when we are validatiing other code.
Pls anyone help how to solve in prodcution 
Is there anyway to handle in test method
  • August 21, 2017
  • Like
  • 0
I craeted custom button on  participant table and link Vf pageto the button . when i clicked on the button , address table will get updated 
This is my controller extension  and Vf page .i need help on the test calss 
public with sharing class PClass{

    public participant__c participant;
    private ApexPages.StandardController stdControler;
    public Id Id { get; set; }
    
    
    public PClass(ApexPages.StandardController stdControler){
        
        this.participant = (participant__c)stdControler.getRecord();
        this.stdControler = stdControler;
            
    }
    
    public PageReference InsertAddress(){
        	
        try{
            participant__c p = [select id, SS_ID__c 
                                from participant__c
                               where Id = :participant.Id limit 1];
                             
           Registration__c r= [select Id,Address1__c, Address2__c,SS_ID__c 
                                                                        from Registration__c 
                                                                        where SS_ID__c =:p.SS_ID__c limit 1];
                                                                        
            Addresses_c  paddress = new Addresses__c();
            paddress.participant__c = participant.Id;
            paddress.Address1__c = r.Address1__c;
            paddress.Address2__c = r.Address2__c;
            insert paddress;
	   }

	   catch (Exception e){}
           return new ApexPages.StandardController(participant).view();
}
VF page 
<apex:page standardController="Participant__c" extensions="PClass" action="{!InsertAddress}" >


</apex:page>
My test class
@isTest public  with sharing class PClass_Test {

    static TestMethod void AddAddress(){
        
        
        Registration__c  TestRegistration= new Registration__c();
        TestRegistration.Name = 'Test Registration';
        TestRegistration.SS_ID__c = Decimal.valueOf(30111);
        TestRegistration.Address1__c='10 Street';
        TestRegistration.Address2__c ='15 street';
        insert TestRegistration;
        
        participant__c TestParticipant = new participant__c();
        TestParticipant.FirstName__c ='Test participant';
        TestParticipant.SS_ID__c =Decimal.valueOf(30111);;
        insert TestParticipant;
        
	Test.startTest();
        ApexPages.StandardController stdController = new ApexPages.StandardController(TestParticipant);
        PClass  pa = new PClass(stdController);
       System.debug(pa.Id);
      
        
       	pa.InsertAddress();
        System.debug(pa);
        
        Test.stopTest();
        try{
        
     		Addresses_c padd = [select id, participant__c from Addresses_c where participant__c =:pa.Id limit 1];
           }
      catch (Exception e){}
}


 
  • August 15, 2017
  • Like
  • 0