Ever need to change a few values in a document that can't be changed via the form because the fields are not there...
or are set to hidden or computed? Usually this means we have to open designer and write an agent to change the values. This tip explains how to setup a smart icon that lets you change any field's value right from the view without creating an agent.
Put the code below into a smart icon's action formula. When you have a document selected and click the smart icon, a dialog box will popup letting you choose from a list of fields inside the document. Select a field and the next dialog box shows you the current value, which you can then edit. As a bonus, if you type in @Delete as the value, the field will be removed from the document.
Note this always changes the value to a text field, so be careful not to change any number or time/date fields.
By the way, you can input multi-values by separating each value with a semicolon.
REM "Change Field Values From A View";
tmpFields := @DocFields;
tmpLastFieldChosen := @Environment("SI_LastFieldChosen");
tmpChangeField := @Prompt([OKCANCELLIST]; "Change Field"; "Please choose the field whose value you'd like to change"; tmpLastFieldChosen; tmpFields);
REM"Save State"; @SetEnvironment("SI_LastFieldChosen"; tmpChangeField);
tmpValue := @Prompt([OKCANCELEDIT]; "New Value"; "Please enter the new value for the field or type @Delete to delete the field."; @Abstract([TextOnly]; 200; ""; tmpChangeField));
@If(tmpValue = "@Delete"; @SetField(tmpChangeField; @DeleteField); @SetField(tmpChangeField; @Trim(@Explode(tmpValue; ";"))))