Thursday, August 14, 2025

Weird behaviour of setPrefix method in D365 FO. Do not use with if condition

 For some reason you cannot do 

{
    setPrefix("MESSAGE");
}
while()
{
    info("ChildMsg");
}


This means you cannot have setPrefix in an if condition or anything which needs curly brackets, the kernel calcualtes what to group based on the curly brackets and as soon as you add any extra, nothing breaks, but it stops doing what it is supposed to do. Could not find any documentation on it so added it here

No comments:

Post a Comment