How Do I Make Required Fields Unrequired from a Command Option?

How Can We Help?

< Back

Question

I have fields that are set to require at design time and run time and this works like a charm when the users decide on some actions that need these fields.

There are some cases however where the user wants to “Save” or “Cancel” the activity and in order to make that simple I need a way to make the fields unrequired from the command option.

At the moment, they are prompted to complete all the required fields simply to save the activity.

At the moment, I am running v5.1.2 but planning on upgrading to 5.1.3

I know the question is a rather simple one, but it is causing a fair amount of inconvenience for our clients.

Answer

At activity level, create a method to handle the required not required as the sample:

public void NotRequired()

{

ObjectGroup NotRequiredGrp = activity.ObjectGroups["0"];

NotRequiredGrp["RE1010Object"].Required = false;

}

Declare a variable outside of the OnRefresh and OnLoad methods:

ObjectGroup grp;

In the OnRefersh method of the activity, add the following:

grp = activity.ObjectGroups["-1"];

EventControl triggerControl = grp["TRIGGER TO CHECK"];

if (Convert.ToString(triggerControl[0, false]).ToUpperInvariant() == "TRUE")

{

NotRequired();

}
Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X