Question

Error on Opprtunities Close as Lost action trigger from code

  • 10 October 2023
  • 3 replies
  • 41 views

Userlevel 1

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

Userlevel 4
Badge

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.

 

Userlevel 1

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

 

 

Userlevel 7
Badge

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

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved