cancel
Showing results for 
Search instead for 
Did you mean: 

Make mandatory fields in account, ABSL (In silverlight)

Former Member
0 Kudos

Hi experts,

I created an incident in my customer tenant test because mandatory fields don't work. And they answered me following:

"it's not sufficient to set the field to mandatory in SDK (this only creates the red star), you also have to implement a check using ABSL (i.e. in BeforeSave event).

Hope this clarifies your issue if not please revert back to us.

Thank you for your consideration and cooperation."

But when I tested using ABSL I created an extension called AccountEXT.xbo using the code that you can see in the following image:


The test field was "Country", and when I tried to save the new account, appeared the error that you can see in the following image:



There are someone that know if it exsists another way to set a field (or an extension field) into a mandatory field?

If anyone can help me with this issue, I will be really grateful

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member210407
Active Participant
0 Kudos

You can now define a field as mandatory with the Key User Tools in the HTML5 UI.

You field will be set as mandatory in both SL and HTML5 UI and raise an error if not filled.

You don't need code anymore to do that.

Jacques-Antoine
Active Participant
0 Kudos

Wow Benjamin, you just taught me something really nice!

If only this could be documented somewhere!

Edit: actually, I just tested it for the Sales Order and it does not work in Silverlight. Actually, all is good in the UI5. You set the field to mandatory, the star appears to mention it is a mandatory field and it raises an error message On-save, preventing the save as the field is not filled. However, when I come back in SL, the star is there, but I can still save the Sales Order even if the field is not filled in.

To come back on the original topic, yes, it seems to be a usual reference problem. If you want to check where the Reference is Null, you can go the the Dump Analysis view of the SDK. Here you can see all the dumps that occurred in the Cloud Solution and it will mention to you for which line in your code the Reference is Null.

From there, it is easy to determine on which field you need to do a IsSet() function, as already said Dan!

Thank you very much!

Best regards.

Jacques-Antoine

Former Member
0 Kudos

Yerko,

Chances are that you may be referencing a node or element that doesn't exist.

The ByDesign and C4C are very strict when it comes to value comparisons if they involve NULL or non-existent elements or nodes.

You'll want to add some "______.IsSet()" checks instead of going directly to the end result. Though i can't see your test data directly, note that any portions of the path in your if statement (the nodes separated by the "."s) may not exist. If that's the case, you'll get the error.

For example, start with:

//If The Current Default Address Information Isn't Set

If (!this.CurrentDefaultAddressInformation.IsSet()) {

     Trace.Info("Current Default Address Information Doesn't Exist");

     return false;

}

Then,

//If The Current Default Address Information Isn't Set

If (!this.CurrentDefaultAddressInformation.Address.IsSet()) {

     Trace.Info("Current Default Address Information Address Doesn't Exist");

     return false;

}

And so on.

Former Member
0 Kudos

Correct.

You can check the "Results" debug facet in studio. It shows how many records a node/association has. Then you can figure out which node/association has no entries. But the null check should be placed in all.