Hi again!
Need to understand how to write to the PSMessages collection without actually throwing Errors/Warnings in Peoplecode. Is there a way to do this?
I've got an App that uses Rowset processing and various Edit flags to trap/process errors without actually throwing any Error() or Warning() statements. Basically I'm just displaying them on an "Errors" page within the same Component, synched up to the primary data page in the same component.
However since my new logic doesn't actually fire an Error() or Warning() statement, the errors are not written to the PSMessages collection, which has become an issue w/ me.
Any ideas?
Title | Under | Posted on |
---|---|---|
Component interface Error: no rows exist for the specified keys | PeopleSoft Technical | 03/15/2019 - 3:54am |
ADD 24 months starting from current month.(peoplesoft) | PeopleSoft Functional | 07/29/2018 - 8:44pm |
TRC values dropdown | PeopleSoft Technical | 04/04/2018 - 12:54am |
how to find missing sequence in GRID and print the mising sequence number while saving through peoplecode | PeopleSoft Technical | 09/11/2017 - 4:49am |
Yes there is Larry, here is a function that I have developed that does exactly that:
Local ApiObject &PSMessages;
Local number &i, &MsgSetNbr, &MsgNbr, &NbrErrors;
/*get only error messages*/
%Session.PSMessagesMode = %PSMessages_CollectionOnly;
&PSMessages = %Session.PSmessages;
&NbrErrors = &PSMessages.Count;
If &NbrErrors > 0 Then
For &i = 1 To &NbrErrors
&MsgSetNbr = &PSMessages.Item(&i).MessageSetNumber;
&MsgNbr = &PSMessages.Item(&i).MessageNumber;
/* MessageBox(0, "", &MsgSetNbr, &MsgNbr, "Message Not Found : " | &MsgSetNbr | "," | &MsgNbr);*/
If &bDisplayErrors Then
/*error*/
If &PSMessages.Item(&i).MessageType = 1 Then
&errorText = &PSMessages.Item(&i).Text;
/* MessageBox(0, "", &MsgSetNbr, &MsgNbr, "Message Not Found : " | &MsgSetNbr | "," | &MsgNbr);
MessageBox(0, "", 0, 0, "&ExplainText = " | &ExplainText);
MessageBox(0, "", 0, 0, "&Text = " | &Text); */
/*InsertResults is a function that inserts &errorText for logging purposes*/
InsertResults();
End-If;
End-If;
End-For;
&PSMessages.DeleteAll();
End-If;
Return &NbrErrors;
End-Function; /* CheckSessionMessages */
Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog
Lepa,
Thanks, but it appears to me that your function is just looping thru the PSMessages Collection and calling the InsertResults() function once for each Message that has a Severity = Error, then Deleting all messages from the Collection once the loop is done.
What I need is something to help me populate the PSMessages Collection without calling the Error() or Warning() commands. I'm not seeing that, unless your InsertResults() routine does that. If so, then that is what I need to see. If not, then this really isn't what I need help with.
Regards,
Larry
Hey Larry,
No, i'm not populating the PSMessages Collection. Infact, it gets populated on its own. PSMessages Collection is a property of the Session Class and i'm using the APIs that are accessible using a session object are:
• Component Interface Classes
• PortalRegistry Classes
• Query Classes
• Search Class
• Tree Classes
The session object handles error processing for the above APIs automatically, so no need to call the Error() or Warning() commands to log errors. In the code above, i'm running the error check after executing some Query class Peoplecode, and i call CheckSessionMessages( True); anytime I suspect an error might happen while using the Query methods and properties.
Are you using any of the above classes in your code?
Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog
No. I was specifically looking for a way to populate the PSMessages Collection myself without calling Error() or Warning() to do so.
Hi
I have created a custom CI..
When CI encounters any error it should be written into PSMESSAGES collection automatically.
But it is not happening..Can you help me out in this.
Thanks
Pazhanivel