on 2022 Mar 09 6:18 PM
Hello Experts,
I've scenario to automate the opportunity item status to WON , when the quototation item is completed. I tried the below coding its not working and throws error as attached.
Any hint what went wrong.?
Code on Item Before Save.
if (this.Status.CustomerQuoteLifeCycleStatusCode == "3")
{
var btd = this.ToParent.BusinessTransactionDocumentReference.Where(n => n.BusinessTransactionDocumentReference.TypeCode == "72");
if (btd.Count() > 0)
{
var opp = Opportunity.Retrieve(btd.GetFirst().BusinessTransactionDocumentReference.UUID);
if (opp.IsSet())
{
var oppItem = opp.Item;
//var oppItems = opp.Item.Where(n => n.PDI_OpportunityReferenceItemUUID.content == this.PDI_OpportunityReferenceItemUUID.content && n.LifeCycleStatusCode != "4" && n.LifeCycleStatusCode != "5");
foreach (var i in oppItem)
{
//Logic to update the status has to be done
//i.FinishCustomerQuoteRequestProcessing();
i.Win();
break;
}
}
}
}
Regards,
Senthil
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Figured out, ExternalStatusCode field is responsible for status change, adjusted the code accordingly and worked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
54 | |
10 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.