2/4/10

How to turn or highlight a field in RED for error messages issued from SAVEEDIT Event?

When an error message is issued in PeopleSoft(Component Processor) from the SAVEEDIT event, the cursor will not be directed to the corresponding field (value) for which the message is thrown. And the field also doesnot turn into red color as is the behaviour with the error messages issued from the FIELDEDIT event.

To position the cursor to the required field in a specific page, we use SETCURSORPOS() function. But unlike in the FIELDEDIT event, the field does not get turned into red color when an error message is issued from the SAVEEDIT event. There is a field property which can be used to turn a field into red. The code snippet is as below:

If (conditions) Then
 REM Procedural way of positioning cursor to required record, field and page;
 Recordname.Fieldname.Setcursorpos(%Page);
 REM Property which turns the field into Red color which is the default behavior of an error message;
 Recordname.Fieldname.Style = "PSERROR";
 REM Any PS Standard way of issuing an error message;
 Error ("The error message to be thrown");
End-If;

 
The above code turns the specified field into Red color and highlights the field in the required target page when an error is issued from a SAVEEDIT instead from FIELDEDIT event.
 
Recordname.Fieldname.Style = "PSERROR";  /* Procedural method of writing this code */
&fieldobject.Style ="PSERROR";                    /* Object oriented method of writing the same code */

13 comments:

  1. Thank you for your post! It helped. Here is piece of code...

    If None(record name.ALS_BANK_ACCT_TYPE) Then
    SetCursorPos(Page.pagename, recordname.fieldname, CurrentRowNumber());
    recordname.fieldname.Style = "PSERROR";
    Error MsgGet(31000, 23, "Please pick a Bank Account Type");
    End-If;

    ReplyDelete
  2. Shravan Yalala8/30/2012 12:48:00 PM

    Thank you for the post. This helped me in resolving a long standing issue in tools upgrade.

    ReplyDelete
  3. Thanks a lot for the post. It helped me too.

    ReplyDelete
  4. Thanks for post, it was helpful.
    I found that field remains red even after correcting the error and hence had to add the below else part.

    Else
    Recordname.Fieldname.Style = "PSEDITBOX";
    End-if;

    ReplyDelete
  5. Hi,

    We have a requirement to display the all the mandatory fields at one shot when the values are not entered in those fields. Could you please let me know how to acheive this.

    ReplyDelete
  6. Hi,

    Normally in peoplesoft when values are not entered for required fields, error message will be displayed sequentially. We have a requirement to display all the mandatory fields in the error message at one shot when the values are not entered in those fields. Could you please let me know how to acheive this.

    ReplyDelete
    Replies
    1. Hi Even i tried putting the values in savedit still im getting the error sequentiallly but not at one shot any help is appreciated!!!

      Delete
    2. you will not get all fields getting error at one go. its always one at a time and sequential.

      Delete
  7. I would suggest to have validations in savedit so that all validations will fire at once. Thats the best option than doin at fieldedit of a particukar field and end up highlighting all other fields.

    ReplyDelete
  8. really helps! :)

    ReplyDelete
  9. Can i make it red even on a grayed out field?

    ReplyDelete
  10. Thnakyou SHyam, for the wonderful piece of code

    ReplyDelete

Please refrain for marketing messages and unnecessary back links.

Workflow errors on New Hire and Add employment instance

User tries to hire a new person or tries to add a new organization relationship encounters a series of error messages related to workflow...

Trending in this Blog this month