Skip to main content

Hi Team,

For one of the customization, we have the following requirement, facing an error with the implementation.

Following represents the requirement, the Code used, and the error we are getting.  Could you please review and suggest to us the recommended way to solve the error

It is in the development stage so we couldn't provide instance details.

Requirement:

We have to maintain a list of duplicate Opportunities which are with the same subject. And while creating a new Opportunity, we need to close all the existing linked/duplicate opportunities.

Hence we are trying to call the CloseAsLost action from code in the Persist method and facing an error.

Could you please suggest.

Code Snippet Used:

 

Error:

 

 

Thanks & Regards,

Vidyakeerthi K

 

 

Hi @vidyakeerthik were you able to find a solution? Thank you!


Hello John, 

Thanks for the response and review.

Actually, we are trying to close all other opportunities with the same subject whenever a new Opportunity is getting created, not the current one.

I agree that Where condition opportunity ID condition is not required, it was removed and verified but no luck.

In fact tried calling the actual logic instead of the direct button, and introduced some other action same logic and triggered from code. It hasn’t solved the error yet.

We are investigating further.

 

Thanks,

Vidyakeerthi K

 

 


Hi Vidyakeerthi K,

Looking at your code snippet it possibly looks like you are attempting to call graph.CloseAs Lost for the actual opportunity you are in. 

 

You are selecting CROpportunity.opportunityId equals the opportunityId of the current record.

Based on what you are looking to acheive I’m thinking that this should be a not equals?

 

 At the moment I think your code may be causing two graphs to be simultaneously working on the same record which could be the cause of the error (especially when you consider that the code may recursively being creating graphs and trying to change the same object).

 

Hope this helps,

 

John.

 


Reply