I am trying to create a simple, or so I thought, view action that does the following:
After the user selects one or more documents in a view they click the “Resign Territory” action button
Once the button is click a prompt appears, asking for the new salesperson # to be assigned to a the selected territory documents.
The action contains the following code:
@SetField(“newsls”;@Prompt([OkCancelList]; “New Salesperson”; “Select New Salesperson #:”; “”; @DbColumn(“”:“NoCache”; “”;“(Salesperson Lookup2)”; 1)));
@SetField(“newslsname”;@Right(@Trim(newsls);" "));
@SetField(“newslsnum”;@Left(@Trim(newsls);" "));
@Command([ToolsRunMacro];“(Reassign Territory)”)
The action calls an agent that is setup to run on all “selected documents”. The agent contains the following code:
@If(@Trim(newslsnum) != “” ;
@Do(
@SetField(“DBSLSM”;newslsnum);
@SetField(“DBSlsName”;newslsname);
@SetField(“newslsnum”;@DeleteField);
@SetField(“newslsname”;@DeleteField);
@SetField(“newsls”;@DeleteField);
@SetField(“newslsprompt”;@DeleteField)
);
@Failure(“Update Failed”));
SELECT Form =“Territory Maintenance”
The whole process only works when a single document is selected in the view.
If I choose multiple documents at once, the process does not work at all.
I’ve added prompts all over this thing to try and figure it. The only thing I am certain of is that the agent is getting run every time for each document that was selected in the view.
This is driving me nuts, what am I missing?
Thank you in advance.