Auto Increased Opportunity number

Dear all,

We are trying to create auto numbering for the opportunity in 7.10.

So far this is what we did.

1. Create system settings for OpportunityCodeMask, OpportunityLastNumber

2. Create a replace module of "Opportunity" and add a new field UsrCode

3. Create an object process contains the following task:

       1) message start with message: OpportunityInserting

        2)ScriptTask "SetNumberGenerationParameter" with code:

GenerateNumberUserTask.EntitySchema = Entity.Schema;
return true;

        3) a user task "GenerateNumberUserTask", task type "Generate ordinal number ( Base )"

        4) as Script task "SetGeneratedNumber" with code 

Entity.SetColumnValue("UsrCode", GenerateNumberUserTask.ResultCode);
return true;

3. Save and publish this process.

However after I create an opportunity, the code is not filled in the newly created opportunity.

I got this from the following URL:

But I did not implement the onEntityInitialized method in the OpportunityPageV2 because I would like to have this number whenever an opportunity is created (copied or created manually, maybe via web services later on).

Is there anyone who had the same situation before?

Some help will be appreciated.


File attachments



Everything is seems like fine. But you could miss something small. It would be helpfull if you could send screenshots of the functionality. 

Anyway, the same functionality is working in the Order object. Please try to compare your code with the code in the Order object (Order package). Please compare the system settings too.

Hi Mark,

Thank you for your suggestion and it is working now. By comparing with Order process, I changed the event from "Before Record Adding" to "Before saving record".  I also changed Message. 



Show all comments