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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (5,265)