cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
halifaxious
Resolver II
Resolver II

how to validate dependency between 2 ordered choice fields

In my model-driven app I have a table with 2 related choice fields: TRL_start and TRL_end. They both use the same optionset, a 9 value, ordered list consisting of Technology readiness levels.  My option set uses TRL descriptions (e.g. "System complete and qualified") rather than TRL numbers (e.g. TRL8) due to client requirements.

 

I need to ensure that TRL_start has a lower TRL value than TRL_end. But the business rule builder does not allow magnitude comparisons of choice field values. i.e. I can't say TRL_start < TRL_end.

 

Does anyone have a good approach for this kind of validation?

1 ACCEPTED SOLUTION

Accepted Solutions
rampprakash
Super User
Super User

Hello @halifaxious,

 

If you want to go with OOB behavior then we need to use Multiple IF ELSE Condition in Business flow to achieve the same (that also we can go with TEXT only).

 

My Suggestion is to go with JavaScript.

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

View solution in original post

3 REPLIES 3
rampprakash
Super User
Super User

Hello @halifaxious,

 

Its Simple, Create one Global Option Set Choice Field with Values

 

Example:

System Complete --> 100001

Qualified --> 100002

 

Use the same Choice Field in both TRL_start and TRL_end

 

then write a Simple JavaScript  as

 

function compareStartandEnd(executionContext){
var formContext = executionContext.getFormContext();
if(formContext.getAttribute("TRL_start").getValue() < formContext.getAttribute("TRL_end").getValue()){
// do your operation
}
}

 

For Writing Javascript you can refer this video too https://www.youtube.com/watch?v=x8kYNCkikgs&t=8s

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

I already have the global optionset defined that way. My design brief is to use OOB functionality unless it is completely impossible.  I take it that adding custom javascript is the only solution?

rampprakash
Super User
Super User

Hello @halifaxious,

 

If you want to go with OOB behavior then we need to use Multiple IF ELSE Condition in Business flow to achieve the same (that also we can go with TEXT only).

 

My Suggestion is to go with JavaScript.

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (1,107)