Hi guys,
how to show in error both message for attachment and reason code at the moment in x ?
if (setup.MandatoryNotificationType == SDSNotificationType::Error) { ret = ret && checkFailed("Attachment is missing. You have to attach your file then save record to submit request"); } if(setup.ReasonCode == NoYes::Yes && setup.ReasoCodeNotificationType == SDSNotificationType::Error) { if(!this.ReasonCode) { ret = ret && checkFailed("Reason code is missing. You have to attach your file then save record to submit request"); } }
how to show in UI while saving both message at the moment ?
Thanks
I don't see any reason why it would not show both messages if this code is executed, and if all the conditions are met so that the code execution reaches lines 3 and 9.
When you debugged it, did it reach lines 3 and 9? If not, did you figure out why? Please share us everything that you learned while debugging it. Thanks!
You call checkFailed() only if ret is true. If you don't want it, don't do it. Call it regardless of the value of ret.
if (setup.MandatoryNotificationType == SDSNotificationType::Error) { ret = checkFailed("Attachment is missing. You have to attach your file then save record to submit request"); } if (setup.ReasonCode == NoYes::Yes && setup.ReasoCodeNotificationType == SDSNotificationType::Error && !this.ReasonCode) { ret = checkFailed("Reason code is missing. You have to attach your file then save record to submit request"); }
Make sure you learn how to use the debugger. It will help you with finding bugs in your code.
Ah, Martin spotted the issue and indeed you have a third condition in line 9 (if ret) and that explains why it doesn't print the second infolog.
Correction :
"Attachment is missing. You have to attach your file then save record to submit request"
"Reason code is missing. You have to attach your file then save record to submit request"
like i want to this massage. its above my code working one by one
Ex: once i give it to reason code next while saving second warning "Attachment is missing" i don't want i want to at same time UI both message.
Then combine both messages in one string before printing it to infolog. Each time you call checkFailed() or info() or warning() or error() it will print a new message to the infolog.
I need to know is that possible ? could you please example for that.
str errorTxt; boolean ret; if (validation1Fails) { ret = false; errorTxt = 'Validation 1 failed.'; } if (validation2Fails) ret = false; errorTxt = ' ' 'Validation 2 failed.'; } if (!ret) { checkFailed(errorTxt); }
Thanks for your answer,
attachment second line i want to if its possible what should i do to change in your code ?
Do you mean that you want to have multiple lines of text in a single infolog message? That's not possible as far as I know.
In general you can add linebreaks with '\\n' into your strings, but infolog will not show them.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,047
André Arnaud de Cal... 885 Super User 2025 Season 2
Sohaib Cheema 592 User Group Leader