Skip to main content
Question

Error on Opprtunities Close as Lost action trigger from code


vidyakeerthik
Freshman II
Forum|alt.badge.img

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

 

 

3 replies

Forum|alt.badge.img
  • Varsity I
  • 63 replies
  • October 10, 2023

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.

 


vidyakeerthik
Freshman II
Forum|alt.badge.img
  • Author
  • Freshman II
  • 12 replies
  • October 12, 2023

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

 

 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2657 replies
  • November 27, 2023

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings