• Purushotham Yellanki
  • NEWBIE
  • 110 Points
  • Member since 2016
  • Sr. Salesforce Developer
  • Vivial Media LLC


  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 27
    Replies
I have a custom object custom_obj__c, where i have to create records upon account merge activity. I am writing the following trigger to acheive
issue is that the Master_Account__c  on custom object is MD relation on Accout and whenever I am trying to merge ..getting this error
"Apex trigger AccountMergeTrigger caused an unexpected exception, contact your administrator: AccountMergeTrigger: execution of AfterDelete caused by: System.DmlException: Insert failed. First exception on row 0; first error: ENTITY_IS_DELETED, entity is deleted: []: Trigger.AccountMergeTrigger: line 9, column 1"
trigger AccountMergeTrigger on Account (after delete) {
    List<Account_Backup__c> listAccountBackup = new List<Account_Backup__c>();
    for(Account acct : trigger.old) {
        if(String.isNotBlank(acct.MasterRecordId)) { 
            listAccountBackup.add(new Account_Backup__c(Name = acct.Name, Master_Account__c = acct.id));  
        }         
    }
    if(listAccountBackup.size() > 0) {
        insert listAccountBackup;
    }    
}

Please suggest
Hello all,

I am unable to insert more than 32 parameters in @httpPost method Please suggest me a better way in order to insert more parameters
Below Is my code:
@RestResource(urlMapping='/Students/*')
global with sharing class Studnets {

   
    
     @HttpPost
    global static String doPost(Integer Max,String ConcurrentAsyncGetReportInstances,String ConcurrentSyncReportRuns,Integer Max1,
    Integer Remaining,Integer Remaining1,String DailApiRequest,Integer DAPIRemaining,Integer DAPiMax,String Ant,Integer AntMax,
    Integer AntRemaining,String App,Integer AppMax,Integer AppRemaining,String DataloaderBulk,Integer DMax,Integer DRemaining,String DPartner,
    Integer DPMax,Integer DpRemaining,String FIde,Integer Fmax,Integer FRemaining,String SFMD,Integer SFMDMax,Integer SFMDRemaining,String SFTouch,Integer SFTMax,
    Integer SFTRemaining,Integer SFOMax,Integer SFORemaining,String SFOutlook)
     {
        System.debug('Entering in to APIUSAGE__c');
        APIUSAGE__c  st = new   APIUSAGE__c();
        st.ConcurrentAsync__c=ConcurrentAsyncGetReportInstances;
        st.ConcurrentSync__c=ConcurrentSyncReportRuns;
        st.Async_Max__c=Max;
        st.Max__c=Max1;
        st.SyncRemaining__c=Remaining;
        st.Async_Remaining__c=Remaining1;
        st.DailyApiRequests__c=DailApiRequest;
        st.DAPIRemaining__c=DAPIRemaining;
        st.DAPiMax__c=DAPiMax;
        st.Ant_Migration_Tool__c=Ant;
        st.Ant_Max__c=AntMax;
        st.Ant_Remaining__c=AntRemaining;
        st.App_Name__c=App;
        st.App_Max__c=AppMax;
        st.App_Remaining__c=AppRemaining;
        st.Dataloader_Bulk__c=DataloaderBulk;
        st.DMax__c=DMax;
        st.DRemaining__c=DRemaining;
        st.Dataloader_Partner__c=DPartner;
        st.DPMax__c=DPMax;
        st.DpRemaining__c=DpRemaining;
        st.ForceIDE__c=FIde;
        st.FMax__c=Fmax;
        st.FRemaining__c=FRemaining;
        st.SFMD__c=SFMD;
        st.SFMDMax__c=SFMDMax;
        st.SFMDRemaining__c=SFMDRemaining;
        st.SFTouch__c=SFTouch;
        st.SFTMax__c=SFTMax;
        st.SFTRemaining__c=SFTRemaining;
        st.SFOMax__c=SFOMax;
        st.SFOutlook__c=SFOutlook;
        st.SFORemaining__c=SFORemaining;
        
        
        
        insert st;
        return st.Id;
    }
    
    
 
}
Hi Community,
I want to transfer notes to salesforce as Chatter Feeds.

I found this post https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_feed_element.htm to create feed-elements via rest api, but I have to set the createdDate property of a record.

In the "setup" I set the 'Enable "Set Audit Fields upon Record Creation" and "Update Records with Inactive Owners" User Permissions' option and my API User Profile got the right to 'Set Audit Fields upon Record Creation'.

Can I set the createdDate via POST Request?
I hope someone can help me.
  • October 26, 2017
  • Like
  • 0
I am writing a test class and am having trouble getting a mthod to test correctly.  The method looks at a couple of parameters and I am not sure how to pass the parameters to the method through my test class.  Can anyone help me?

I need to pass the SelectBox = True and the Participated = false paramerters to this method.  
    public pageReference saveContacts(){
     List<eventRelation> addeventRelation = new List<eventRelation>();
     for(cContacts c: getTeamMember()){
        IF(c.selectBox ==  true && c.participated == false){
            eventRelation ev = new eventRelation();
            ev.RelationId =  c.cId;
            ev.eventId =  eId;
            addeventRelation.add(ev);
     }
    }
    insert addeventRelation;
    pageRef.setRedirect(true);
    return pageRef;
    }
My test method.
 PageReference page = new PageReference('/apex/EventTeamMemberSelection?scontrolCaching=1&id=' + testEvent.Id);
        Test.setCurrentPage(page);
        Test.StartTest();
        ApexPages.StandardController stdCont = new ApexPages.StandardController(testEvent);
        EventTeamMemberSelection extCont = new EventTeamMemberSelection(stdCont); 
        pageReference addCon = extCont.saveContacts();
        pageReference delCon = extCont.deleteContacts();
        Test.StopTest();
Hi all,

I want to clear the lookup field value when std.CLONE button is cliciked. I have tried with syntax below
https://cs5.salesforce.com/XXXXX0000000XXXX/e?clone=1&retURL=%XXXXXX000000XXXt&00N3A00000Cg7BD_lkid=&01I3A000002nfCG=

But the lookup value is not getting cleared. Can anyone help me overe here.

Thanks in advace.
Regarding,
naga.
I have passed the below param.

 
"client_id", "XXX"
"client_secret", "YYY"
"grant_type", "password"
"username", "$$$"
"password", "###"

what's am i missing?

Advance thanks
How can I create a database in SalesForce. I don't care about the language, I just want to be able to make a large capacity database that I can interact with via SalesForce, Apex, or VisualForce. Currently my solution seems to run out of memory. I have read in-to MySQL, PHP, etc - however I can't find a way that SalesForce can interact with these. I have also heard of Cloud Database or Force.com, however, I again, haven't been able to see examples or anything that would actually help me beyond an advert. Can anyone lend a hand? 
Hey guys,

I have created a WFR which updates the Approval_Status__c field to a null value if the Opportunity has already been approved and a user goes back into the record and makes a change to any of the fields.
I would like to an email to be sent to management which notifies them that a particular record has been changed and along with this it should define the fields that have been changed. It would be great if I could inlude the previous / new values.

Is this possible?
  • October 25, 2017
  • Like
  • 0
I have a custom object custom_obj__c, where i have to create records upon account merge activity. I am writing the following trigger to acheive
issue is that the Master_Account__c  on custom object is MD relation on Accout and whenever I am trying to merge ..getting this error
"Apex trigger AccountMergeTrigger caused an unexpected exception, contact your administrator: AccountMergeTrigger: execution of AfterDelete caused by: System.DmlException: Insert failed. First exception on row 0; first error: ENTITY_IS_DELETED, entity is deleted: []: Trigger.AccountMergeTrigger: line 9, column 1"
trigger AccountMergeTrigger on Account (after delete) {
    List<Account_Backup__c> listAccountBackup = new List<Account_Backup__c>();
    for(Account acct : trigger.old) {
        if(String.isNotBlank(acct.MasterRecordId)) { 
            listAccountBackup.add(new Account_Backup__c(Name = acct.Name, Master_Account__c = acct.id));  
        }         
    }
    if(listAccountBackup.size() > 0) {
        insert listAccountBackup;
    }    
}

Please suggest
I am needing to include a string of text in my soql query. Is this possible?
In sql server the following query works and returns the text, but how do I do this using SOQL?

SELECT [LastModifeidDate]
      ,[Plaintiff_Full_Name__c]
      ,[Pliantif_Last_Name__c],
   'hello world'
  FROM [ERP].[dbo].[Cases]
Thanks,
KS
Hi All
I have 3 custom object ob1__c,ob2__c,Ob3__c.

ob1__c and ob2__c has master-detail relationship,so that ob2__c record owner is ob1__c record owner(ob2__c does not have any record owner because in matser-detail child does not have record owner).

ob3__c and ob2__c has lookup relatioship.but my requirement is wneh i am going to create a record on ob3__c and select ob2__c record uisng look up dialog.after record save need to update record owner of ob3__c based on ob2__c selected record owner.how it is possible.
 
I'm trying to integrate a third party with salesforce, but I'm stuck receiving a 'down for maintenance' screen when I try to authenticate. Here's what I've tried:
1. I have a simple visual force page which does no read/writes to object records (so permissions shouldn't be an issue). I can access it when logged in as administrator.
2. A simple force.com site which points to this page. Permissions are such that I can access it publicly (once I add object record read/write that changes).
3. A connected app configured for full oauth scope (and everything else)
4. I get an oauth_token using https://test.salesforce.com/services/oauth2/token (because it's a sandbox)
5. When I access the force.com site with that oauth_token as a url param, I get a 'down for maintenance' message. Whereas before (2) I could access it completely publicly.

I have a hunch the oauth_token is failing and instead of showing an error, but I can't find any logs to support that.

Any idea how I can configure or debug a force.com site to accept connected app oauth 2 tokens?
Hi

I need to get order data through WSDL AIP. When I call query "Select id from order", I receive 

MALFORMED_QUERY: 
select id from Order  order by Id desc 
              ^
ERROR at Row:1:Column:15
line 1:15 no viable alternative at character '"'

I understand Order's object is conflicting with sentence "order by". 

How get data order ?
Hi All,

I would like to prepare dynamic JSON body for all the contact records with masked values like below mentioned format. If contact field value is exist in need to send it as True, if it is not exist send it as False. How to achieve this apex.

{
  "Id":"0032800000240hnAAA",
  "Name": "True",
  "LastName": "True",
  "OtherAddress":"Flase",
  "MailingAddress":"True",
  "Phone":"True",

},
{
  "Id":"0032800000240hnAAA",
  "Name": "False",
  "LastName": "True",
  "OtherAddress":"True",
  "MailingAddress":"True",
  "Phone":"True",

}

Thanks,
Anil Kumar

Context
We are a company that builds a live chat solution. Recently, we decided to save the conversations into our customer's Salesforce accounts. We did this by implementing a connected app to which our users would login with their Salesforce via oAuth. After we retrieve their access token we start creating in his name an activity for each call.

Questions
Is it ok to have this app on a developer edition account?
Should it be published somehow, in the AppExchange or somewhere else?
Will other accounts, rather than development edition ones, be able to log in into it?

Hello All ,

I need to make the field required in Apex webservices class

I have variable  firstName and it should be mandatory in services 

webservice string firstName; is the syntax.When i generate the schema it's shows as below.
<xsd:element name="firstName" minOccurs="0" type="xsd:string" nillable="true"/>
how to make the minOccurs="1" through apex class
<xsd:element name="firstName" minOccurs="1" type="xsd:string" nillable="true"/>


Thanks for help.

Regards,
Ashok N
 
Hi there,

Can we use a SWITCH control statement in the APEX class? Is it possible and supported by APEX?

thanks