Home Service Manager Portal Feature Requests
We appreciate you taking the time to vote and add your suggestions to make our products awesome! Your request will be submitted to the community for review and inclusion into the backlog.

We recommend reviewing what is submitted before posting, in case your idea has already been submitted by another community member. If it has been submitted, vote for that existing feature request (by clicking the up arrow) to increase its opportunity of being added to Cireson solutions.

For more information around feature requests in the Cireson Community click here.
Options

Cireson Portal fields mandatory based on other fields value

From our business we have optional maintenance contracts or custom support options for our software contracts that have a relationship with date and/or other field.

So when a software CI has a maintenance contract, a boolean field is changed from 0 to 1. Once this boolean is changed to 1, we would like some other fields, like date fields, to become mandatory.

At the moment, I can make a field mandatory by Required: true, but then it always applies, I would like to have the functionaliteit to let it be dependent on another field.

2 votes

Active · Last Updated

Comments

  • Options
    Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    @Bart_Leving it is possible to have fields be required based on the condition of a Boolean field. Rather than setting Required to true or false, you can set it to a Boolean property. I'm not sure which Boolean property you're wanting to base the requirement on, but you can use pageForm.viewModel.<propertyName> as the value for Required. Here is a screenshot from the incident form that makes Assigned User required if the Escalated box is checked:


    The only catch to this is it doesn't take effect immediately. The page has to refresh before requirement is enforced.

  • Options
    Bart_LevingBart_Leving Customer IT Monkey ✭

    Justin, thank you, I will check this out.

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
    edited March 26

    @Justin_Workman I tried that in our Software Asset Form with a boolean and it didn't work :( When I wrote it like in the screenshot I wasn't able to open any SW asset, as a layout error has been shown and when I set it under quotation marks, it doesn't work neither.

    Is there some dependency I have to check?

  • Options
    Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    @Simon_Zeinhofer - Which property were you using on the Software Asset?

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    @Justin_Workman a custom Property (Enumeration List), which should only be required, when a custom boolean is set to true.

  • Options
    Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    What's the name of the bool property? Can you show me your form definition?

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    @Justin_Workman the form definition is as followed:


    { DataType: 'Boolean', PropertyDisplayName: 'Show Software in Portal', PropertyName: 'ShowSoftwareInPortal', Disabled: false, Inline: true, Required: true},
    { DataType: 'Enum', PropertyDisplayName: 'Whom to Show Software in Portal', PropertyName: 'WhomToShowSoftwareInPortal', Required: pageForm.viewModel.ShowSoftwareInPortal, EnumId: '6118f0de-a512-94a8-0023-de79257f1010' }
    

    But when I use it that way, an error message appears, whenever I want to open a SW Asset in the portal

  • Options
    Bart_LevingBart_Leving Customer IT Monkey ✭

    I experience the same issue with my custom property (Date Field), which should be required when custom boolean is set to true.

    I have double checked the values in the class to be correct, but once I add: Required: pageForm.viewModel.<value>, the license page goes into error.

  • Options
    Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    @Simon_Zeinhofer @Bart_Leving - you guys are correct! The Asset Management forms go through some additional backend validation that the work items don't go through and therefore can't have js statements determine the requirement on the controls. I built a custom task to get around this. It's available here:

    https://github.com/justinkwork/SWARequired/blob/main/SWARequired.js


    This has the added benefit of listening for changes to the viewModel and therefore the requirement on the contingentProps updates according to the current value of the boolProp.

  • Options
    Geoff_RossGeoff_Ross Cireson Consultant O.G.
  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    @Justin_Workman How about a "Definitive Cireson JavaScript " Course, like Adam's powershell one 😁

  • Options
    Geoff_RossGeoff_Ross Cireson Consultant O.G.

    Simon,

    Its an interesting request. Have you watched the eLearning Masterclass? Particularly these two sections?

    • Portal Customization – Tasks
    • Portal Customization – Editing Pages

    Geoff

  • Options
    Bart_LevingBart_Leving Customer IT Monkey ✭
    edited March 28

    @Justin_Workman Thank you for the code!

    I will also implement this on our side.

    I understand which variables to use, but I am not used to work with javascript tasks in the Cireson Portal. Should I put the piece of code from SWARequired.js in the Custom.js file or can I have just separate .js file like SWARequired.js in my Custom folder for all the fields that I want to have this functionality?

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    @Geoff_Ross as we don't have Cireson Plus, we haven't :(

    Looks very interesting though :)

  • Options
    Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    @Bart_Leving - You can add the SWARequired.js file to CustomSpace then call it using loadScript. You will have to add loadScript to your custom.js. Here is a quick instruction on that:

    https://community.cireson.com/discussion/comment/14268#Comment_14268

  • Options
    Bart_LevingBart_Leving Customer IT Monkey ✭

    @Justin_Workman Thank you, that works for me.

    In my case with License management, I had to change SoftwareAsset into License, but then adding the loadScript to custom.js makes everything work like a charm.

  • Options
    Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    @Bart_Leving - Great! Glad to hear it!

Sign In or Register to comment.