Composing document based on another document

I have an agent that is called from an outline entry that is half way working. What was happening in R5 was a document was being created based on another document. The second document that is created should inherit the work order number from the first document. The document is being created in R6 but the work order number is not coming over. If I put in a picklist prompt it works but, I do not want to do that. I need to avoid that part. The document has inherit values checked. If you have any ideas I would greatly appreciate it. Here is the existing formula:

FIELD Form := Form;

FV := @DbLookup(“Notes” : “NoCache”;@DbName; “FormDup”; Work_Order_No;2);

@If(Form_Desc != “Work Order”;

    @Do(@Prompt([Ok];"Work Order Document Must be highlighted"; "Please ensure that a Work Order is highlighted, or that one exists so that this document may be created. Please try again.");@Return(""));"");

@If(@IsMember(“FS”;FV);

    @Do(

@Prompt([Ok];“Feasibility Study Already Exists”; “A Feasibility Study for Work Order: “+Work_Order_No+” already exists. Please open the existing Feasibility Study for more information.”);@Return(“”));“”);

@If(WO_Status != “Open” ;

      @Do(@Prompt([Ok];"Work Order Selected Not Open";"In order to create a valid Feasibility Study document the Work Order selected must have a status of Open. The current Work Order status is: "+WO_Status+". Please try again.");@Return(""));"");

@If(Work_Order_No = “”;

@Do(@Prompt([Ok];“Select a Work Order”;“In order to create a Feasibility Study document, you must first select a valid and Open Work Order document from the View. Please try again.”);

@Return(“”));“”);

@Command([Compose];“FS”)

Thanks so much for all your help!

Dawn

Subject: Composing document based on another document

You said you selected the inherit option on the form, but you didn’t talk about the default value formula for the field.

The fact that the code runs from an outline makes me wonder whether it will have access to the context of which document is displayed in another frame. You might have to set the frame and use @UpdateFormulaContext.

Also note that rather than putting up a dialog to complain, you could just open the existing document if you find one.

Subject: Thank you so much ! That worked

Thanks alot, your advice along with the help on the @UpdateFormulaContext helped. It did the trick. I did have the formulas for each of the necessary fields set with the field name.

Thanks Again.

Dawn