You need to sign in to do that
Don't have an account?
Marry Stein
Unable to pass opportunity stagename as parameter
hi guys,
i have created a data factory class. i am struggeling to pass the stagename of the opportunity as parameter. This is my code:
i have created a data factory class. i am struggeling to pass the stagename of the opportunity as parameter. This is my code:
public static Opportunity createOpportunity(String stageName, Id accountId){ Opportunity opp = new Opportunity(); opp.Name = 'Test'; opp.StageName = stageName; opp.Type = 'Neukundengeschäft'; opp.AccountId = accountId; opp.CloseDate = System.today(); opp.z_Vertragsbeginn__c = Date.newInstance(2019, 1, 1); opp.z_Enddatum__c = Date.newInstance(2019, 12, 31); return opp; }
// here i pass the parameter stage1 Opportunity opp = DataFactory.createOpportunity('stage1', acc.id); // but this condition fails, it is null System.assertEquals(opp.StageName, 'stage1')
I appreciate your help guys !
Greetings marry
It will keep all values.
All Answers
I just checked this in my org and it worked. The only issue I can see is you are missing semicolon in system.assert. Will you add tht and check.
If this answer helps you, please mark it as accepted.
Regards,
Tushar Sharma
https://newstechnologystuff.com/
i have found the error in another methode:
this line of code causes the error: I create a completely new sobject, and because of that i delete my predefined values. Do you know how to copy the sobject sobj in my parameter list ?
Greetings Marry
It will keep all values.