You need to sign in to do that
Don't have an account?

Relating Cases to Opportunities
I have been tasked with trying to figure out how to link a case (Created via API) to an already existing Opportunity.
I tried via web-to-case, creates new case but does not fill out lookup field. (Found that this will not auto populate Lookup Field) so had to ditch that attempt.
Now I have the Opportunity ID being saved in a hidden field on the case, then I tried a WFR. Which again is not going to do this for me, so I am stuck with writting a trigger (I think this is my only option) where it will take the ID from the Hidden Field and push it into the lookup (Lookups work on ID's if I am not mistaken)
My issue is, I am not super good at the whole trigger writing as I am just getting into more of the dev side now.
I have this as my trigger so far and was wondering if someone would be able to suggest or point out what I am doing wrong.
trigger OpportunityLookupSet on Case (before insert) {
for(Case c : Trigger.new){
if(c.Origin = 'ICE Cloud'&& c.MVDev__Opportunity_ID__c != null)}{
c.MVDev__Opportunity_ID__c = c.MVDev__Linked_Opportunity__c;
}
}
}
WIth this one I get an error saying "AND operator can only be applied to Boolean expressions" However I need to make sure that the origin is ICE Cloud (Hardcoded) and the Opportunity_ID__c is not blank.
Any help would be great.
Thanks in advance.
Mark
I tried via web-to-case, creates new case but does not fill out lookup field. (Found that this will not auto populate Lookup Field) so had to ditch that attempt.
Now I have the Opportunity ID being saved in a hidden field on the case, then I tried a WFR. Which again is not going to do this for me, so I am stuck with writting a trigger (I think this is my only option) where it will take the ID from the Hidden Field and push it into the lookup (Lookups work on ID's if I am not mistaken)
My issue is, I am not super good at the whole trigger writing as I am just getting into more of the dev side now.
I have this as my trigger so far and was wondering if someone would be able to suggest or point out what I am doing wrong.
trigger OpportunityLookupSet on Case (before insert) {
for(Case c : Trigger.new){
if(c.Origin = 'ICE Cloud'&& c.MVDev__Opportunity_ID__c != null)}{
c.MVDev__Opportunity_ID__c = c.MVDev__Linked_Opportunity__c;
}
}
}
WIth this one I get an error saying "AND operator can only be applied to Boolean expressions" However I need to make sure that the origin is ICE Cloud (Hardcoded) and the Opportunity_ID__c is not blank.
Any help would be great.
Thanks in advance.
Mark
You have written the write code. Just a simple syntax issue. When comparing boolean variables use == symbol to compare.