You need to sign in to do that
Don't have an account?
sfadm sfadm
Allow Process Builder to Save Process With No Immediate Action
Hello,
What I need to achieve is explained in the image of my process builder.
I need a dump or fake action of not doing anything when the first condition is met.
Becauser there is no standard way in Salesforce to allow the process builder to save process with NO immediate action I used the following apex class.
It does not cover the code in my ReturnNull_Class.
Here is the implementation of the Test Class:
What I need to achieve is explained in the image of my process builder.
I need a dump or fake action of not doing anything when the first condition is met.
Becauser there is no standard way in Salesforce to allow the process builder to save process with NO immediate action I used the following apex class.
public class ReturnNull_Class { @InvocableMethod(label='Return null' description='Returns null for use in Process Builder.') public static List<String> returnNull(){ return null; } }The issue I have is with the test class.
It does not cover the code in my ReturnNull_Class.
Here is the implementation of the Test Class:
@isTest private class ReturnNull_Test { static testmethod void returnNullTest(){ ReturnNull_Class.returnNull(); } }Please andvise as well as please share an example of a test class which can help me achieve sufficient code coverage in the ReturnNull_Class?
I trust you are doing very well.
Your test class is absolutely fine. I have checked in my org and it is working fine. It is covering the class. Please try to run the test again.
Also, it is an idea (https://success.salesforce.com/ideaView?id=08730000000sXtlAAE) to 'Allow Process Builder to Save Process With No Immediate Action'. You can check the Jared Jones solution/workaround on that idea, which says:
Use an update record action, and set the criteria for updating records to the option "Updated records meet all conditions". Then set a condition that will never be true. For example, Account Name = "Condition designed to never be true".
It is much easier than creating an apex class and it's test class.
You can also refer to the below blogs which might help you further.
https://ericsplayground.wordpress.com/2016/11/10/how-to-tell-process-builder-to-do-nothing/
https://automationchampion.com/2018/04/10/getting-started-with-process-builder-part-86-what-create-a-process-with-no-action-really/
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.
Thanks and Regards,
Khan Anas
All Answers
Please advise how to increse the code coverage?
I trust you are doing very well.
Your test class is absolutely fine. I have checked in my org and it is working fine. It is covering the class. Please try to run the test again.
Also, it is an idea (https://success.salesforce.com/ideaView?id=08730000000sXtlAAE) to 'Allow Process Builder to Save Process With No Immediate Action'. You can check the Jared Jones solution/workaround on that idea, which says:
Use an update record action, and set the criteria for updating records to the option "Updated records meet all conditions". Then set a condition that will never be true. For example, Account Name = "Condition designed to never be true".
It is much easier than creating an apex class and it's test class.
You can also refer to the below blogs which might help you further.
https://ericsplayground.wordpress.com/2016/11/10/how-to-tell-process-builder-to-do-nothing/
https://automationchampion.com/2018/04/10/getting-started-with-process-builder-part-86-what-create-a-process-with-no-action-really/
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.
Thanks and Regards,
Khan Anas