Skip to main content

Posts

Showing posts from March, 2019

Why is it a bad idea to hardcode workflow id in your code?

You might have faced a scenario where you have to trigger workflows or an actions through plugins or JavaScript code. And you might have hard coded the workflow id in your code. There are few things that I would like you to reconsider before you get tempted to hardcode the workflow id in your code. Take a workflow name that you have been working lately and replace it on the following fetchxml. < fetch top = " 50 " >   < entity name = " workflow " >     < attribute name = " versionnumber " />     < attribute name = " name " />     < filter >       < condition attribute = " name " operator = " eq " value = " Workflow Name " />       < condition attribute = " statecode " operator = " eq " value = " 1 " />     </ filter >     < order attribute = " versionnumber " />   </ entity > </