Conditional Expressions

Conditional Expressions are a powerful tool in Maximo/TPAE based products. In this article I present all the possible usages of conditional expressions and a list of small tutorials that explains how to use them in many real world scenarios.
If you think there is something missing don't hesitate to comment this page or contact me.

There are four ways of using Conditional Expressions.
  • Conditional UI: Allows to dynamically change the presentation elements for an application based on a combination of the security groups the user belongs to, and the conditional expression being used. For example, if the asset is a type=IT, then the labels will change to "IT Asset", and if it was another type of asset, the original label will be used instead.
    This can be configured in the Application Designer application through the Configure Conditional properties button of each control properties panel.
  • Conditional Sigoptions: Allows to dynamically grant or revoke the user's privilege to use a security option base on a conditional expression. For example, if the asset is a type=IT, then the user cannot delete, and if it was another type of asset they can delete the asset.
    This can be configured in the Security Groups application under Applications tab.
    The Sigoptions are often used in conjunction with the conditional UI to further refine rules to the behaviour of specific UI controls.
  • Global Data Restrictions: Allows to dynamically hide or make readonly/required specific objects and attributes.
    This can be configured in the Security Groups application Global Data Restrictions menu action.
  • Group's Data Restrictions: Allows to dynamically hide or make readonly/required specific objects and attributes for a specific security group. For example, all contractors can only see Work Order for a nominated contract and staff can see all Work Orders.
    This can be configured in the Security Groups application under Data Restrictions tab.

Tutorials and HowTo guides

Conditional UI (Application Designer)

Data Restrictions (Security Groups - Data Restrictions)

Conditional Sigoptions (Security Groups - Applications)

Conditional properties
Obviously the above list of tutorial and guides cannot cover all the possible customization scenarios. A big problem could be to determine what properties can be used for each UI control. Here is a document from IBM with the list of available properties for each control.
You may also could take a look at [SMPDIR]\maximo\applications\maximo\properties\control-registry.xml file. Find whichever control you want to manage and you will see all the available properties for that control.

Other Resources

50 comments:

  1. Something that might help others is;
    When creating the expression the use of variables such as :PERSONID or :USERID would refer to the field on the current record,
    you need to use :&PERSONID& or :&USERID& instead if you want to refer to the current user's information.

    e.g. I used the following condition to allow Person Group default to have the Save access to their groups.
    persongroup in (select pgt.persongroup from persongroupteam pgt where pgt.resparty = :&PERSONID& and pgt.groupdefault = 1)

    I created the condition, then in the Security group I was using, under the Applications tab, Options for Person Groups, I granted Save Person Group access and added the conditional expression. (Read access was already enabled)

    Now when a person has been set as the default for a group they can manage the group without reference to the Service Desk.

    ReplyDelete
    Replies
    1. Bruno,

      I have created a custom table as a child table. I want to put a conditional experession on it that makes the child record read only. I am doing this in Application Designer using a conditional expression but the section disappears when I login other than maxadmin. If I change the sig option data source to mainrecord then the section reappears but then the record section is no longer read only. Any suggestions? Thanks, Joseph

      Delete
    2. Please post support questions like this on developerWorks forum: http://www.ibm.com/developerworks/forums/forum.jspa?forumID=1119

      Delete
    3. Hi Bruno, I was wondering on how to make a Filed to default to a value based on the Security groups a User is using ? We know we can have a field a default value , BUT how to Change / have it different based on the security groups a user is logged in to system ? Or based on a particular filed in work order screen ?

      Delete
  2. Great work Bruno and Mark. Very useful for people who are relatively new to Maximo like myself.

    ReplyDelete
  3. Hi Bruno,

    Thanks for all your articles. They are really good specially for me, as I am new to Maximo.

    Wanted your views on the following:

    We are currently using conditional expressions for setting field properties.And for business rules , we code that in java.

    We are trying to weigh out the pros and cons to have business rules in conditional expressions rather than in Java.

    Any help would be appreciated. Or if you can direct me to the right resource as I can't find much on this anywhere on the net.

    Regards
    Aryan

    ReplyDelete
    Replies
    1. You can't find anything on this maybe because there is no perfect answer to your question.
      It really depends on many factors:
      - If you have good Java skills in your organization
      - If you have good SQL skills in your organization
      - If you are planning to move to TPAE 7.5 in the near future (scripting)

      As a very general rule I would suggest to avoid Java if you can. IBM does not officially support Java customization. Unfortunately, many times Java customization is the only option...

      Delete
  4. Bruno,

    I have been following your blog regularly. Its a great work you are doing by building Maximo Knowledge Pool.
    I want to know the how tree , tree node and tree attribute are used in maximo Application Desiging (Actually i want to create a similar tree structure, that gets displayed when we click on Classification in Service Request Application).

    I would really appreciate if you can post something on creating tree, tree node and tree attributes

    ReplyDelete
    Replies
    1. hi if you fund a tutorial for tree send me the url please. thanks

      Delete
  5. Any idea how to search an asset classification attribute from the list tab in work order? I need to add the attribute to the list tab and make it searchable.

    ReplyDelete
  6. There is the attribute search under advanced search which should do what you are looking for

    ReplyDelete
  7. Conditional Expressions to control, say the color of a field don't seem to work on non MAINRECORD data, for example the color of the alnvalue field on the ASSET.SPECIFICATION tab. Does anyone know a way around this so it may be controlled conditionally?

    ReplyDelete
    Replies
    1. I think it can be done.
      Can you please describe your need and post the conditional expression that you are trying to use?

      Delete
  8. Bruno,
    With regard to conditional expressions, can you explain when the 'READ' signature option should be used, versus 'SAVE', versus a newly configured one?

    Thanks

    ReplyDelete
  9. I need to give Insert button click access on Incident app only to those users who have supervisor?
    How can I do this using Conditional expression ?

    ReplyDelete
    Replies
    1. Hi Babloo,Have you got any solution for the above mentioned scenario. Even, I have a similar requirement, where INSERT option on tool bar should not be visible, but grant access should be present from back end. But, for MAXADMIN, INSERT icon should be present on tool bar having access.

      Delete
  10. Hi Bruno,

    Thanks for the useful information and your blog. Really useful for me...

    I'm trying to make an application 'readonly' when its status is 'cancelled' by using global data restriction. I followed the steps you described exactly and it works on already saved data. But when i tried to cancel a new object i get this error:

    BMXAA6002E - You cannot save object POWERCONTAPP : Powercontappid=423 because of the data security restrictions. If you save the object, it becomes read-only and hidden from you.

    I would really appriciate if you can help me solve this problem.

    Thanks in advence.

    ReplyDelete
    Replies
    1. I think that the error you are mentioning depends on the fact that the data restriction is also hiding the object in 'cancelled' status. In my experience you should be able to change the status of an object where the target status is readonly.
      If this is not your case, you may try to play a little bit with the :$OLD_STATUS variable to define the conditional expression on the original value of the status field.

      http://maximodev.blogspot.it/2012/08/variables-dynamic-queries-conditional-expressions.html

      Please let us know...

      Delete
    2. When i changed the condition from :

      :status = 'CANCELLED'

      to

      :$old_status = 'CANCELLED'

      Still didn't understand why this occurs though... Anyways thank you very much !

      Delete
    3. Could you try unchecking the 'Reevaluate' flag?

      Delete
    4. I've tried it with ' :status= 'CANCELLED' condition but didn't work

      Delete
  11. Hi Bruno, I am a beginner in maximo configuration, I have a requirement to make few fields of 'Materials' subtab of Work Order application readonly based on some conditions. In the app designer created a sigoption and added a security group, condition and set the inputmode as readonly for false and inputmode as 'default' if condition is true.
    In the actual UI, when the condition becomes true, the field is getting vanished from the details section as well from the grid column. How can i achieve this?

    ReplyDelete
    Replies
    1. Did you grant access to this Sig option(security group which for true condition)? Also not sure how default is working for you for true condition.

      Delete
  12. i wana that a checkbox should be checked or unchecked based on a condition in maximo
    so what will be property -value in configure conditional expressions?

    ReplyDelete
    Replies
    1. Hi Dev,

      I have similar requirement. Can you please share the solution?

      Thanks,
      Anil R

      Delete
    2. can you share witm me the solution.i also have similar requirement.

      Delete
  13. Just a quick update on Mark's bit above; there is a typo:

    "e.g. I used the following condition to allow Person Group default to have the Save access to their groups.
    persongroup in (select pgt.persongroup from persongroupteam pgt where pgt.resparty = :&PERSONID& and pgt.groupdefault = 1)"

    should be:

    persongroup in (select pgt.persongroup from persongroupteam pgt where pgt.respparty = :&PERSONID& and pgt.groupdefault = 1)

    (respparty instead of resparty; CE was throwing me faults)

    ReplyDelete
  14. Hi Bruno,
    I have a scenerio in which i have to used one communication template and sendfrom and replyto of this communication temlate will change automatically based on site. This notification will based on escalation.What is best way to achieve this ? cheers

    ReplyDelete
  15. High Bruno,

    I need to make a field in the application, that is normally read-only, editable only in a certain workflow node. After leaving the node the application field should return to read-only status. Can you help here?
    Cheers

    ReplyDelete
  16. nice post very helpful one this will surely help a lot of people great job!


    Thin Client Hardware & Citrix Thin Client

    ReplyDelete
  17. Hi Bruno,

    How to disable the New Row button on Maximo 6 based on current user privilege

    Thanks,

    ReplyDelete
  18. Bruno, can we run a update SQL statement from Maximo 7.5 UI?

    ReplyDelete
  19. Bruno, I would like to expose the orgid field on the searchmore dialog in the WOTRACK application. I added a textbox and tied it to the appropriate db attribute, but when I attempt to instantiate the control I got an invalid binding error. I found an example in another application where orgid is exposed in the searchmore (ASSETCAT - this was my template for implementing it in WOTRACK). I noticed this attribute (CLASSTRUCTURE.ORGID) has a java class associated to it (FldClassStructureOrgid). I assume this is how the list of orgids is populated. I would prefer avoiding java customizations, if possible. Any ideas? Thanks in advance - Derek

    ReplyDelete
  20. Hi Bruno,

    I am stuck up with an issue. Need your help.

    Issue: I have added a sigoption for a Tab and given access to everyone and added a condition.

    If the condition is true then it should make the tab in RED color.

    But right now the tabs are hiding and even if i click on New Record , its not coming and i am not able to see the tab. But if i am going to List Tab and hitting enter then i am able to see the tabs and then after that if i do any operation tabs will be visible.

    Please help.

    ReplyDelete
  21. I'm try to make some fields ( Order Qty, Unit Cost,Line Cost on POLine ) become read-only when a PO revised as internal change checked. What I have done:
    - create conditional expression to check current PO is in PNDRev and internal Change is Checked
    - create new signature option and apply it on that fields.
    - set security on specific groups for that new signature option

    But it doesnt work for me, I thought maximo internal process "overwrite" it :( do you have any suggestion to me how can I do without creating custom java class?

    ReplyDelete
  22. Hello Bruno,

    I am have used Conditional Expression to make a Multipart Attribute required if say worktype = ABC, else not required. So the conflict i am facing here is that even the Descrition field for this text box becomes required. And i dont want that. I have tried numerous conditional property options to make thay field not required or to set a default value,and none worked. Any pointers to resolve this isssue?

    ReplyDelete
  23. Can you use this functionality to allow a person to be a supervisor for more than one workgroup?

    ReplyDelete
  24. Hi Bruno, we are trying to give a certain security group the ability to add/upload attachments in Assets application. They currently have read-only access to Assets and we do not want to give them write/save/update access. How can we do this using conditional expressions? Thanks for your time in advance!

    ReplyDelete
  25. Hi Bruno, first thank you for sharing information. I have a challenge that need your advice. Currently i'm trying to apply array in expression builder in workflow Condition Node as below in Incident App.
    :PERSONGROUP[0].PERSON.PRIMARYEMAIL. this is working.

    But i wan to set array parameter as dynamic which 0 will be inherit from one of the attribute like below example.
    :PERSONGROUP[:counter].PERSON.PRIMARYEMAIL
    This is not working. It is there is any way to do this?

    Thanks in Advance.

    ReplyDelete
  26. Hi Bruno,

    I am logged in as a user with only read only access to Item application but I still need to have an option to add/modify image. what is the best way to implement this and how.

    Any inputs are very much appreciated.

    ReplyDelete

  27. Hi Bruno,

    I have created WO..
    In wo application under Plans tab, I addedd few Items in Materials subtab. When I went to Inventory Usage, After clkicking select reserved Items, I am not able to see the workorder itself and also ITEMS attached to this WO. I have gone through the configuration in APP designer. Its fine.

    What is cause and solution for this.

    Thanks In advance.

    ReplyDelete
  28. Hi Bruno,
    Great Site!!!!
    I have created a SQL scrip that will build all aspects of a Conditional Expression including including creating a new Condition; creating new Signature Option; granting rights for the Signature Option; and creating the properties of the Condition (i.e. input mode read only).
    Our build admins find this very useful when this has to be migrated through many systems (DEV, QA, PROD).

    -- set global variables
    -- this example sets Work Order Description read only for members of the security group "ALLSITES" when WORKTYPE="PM" and ISTASK=0
    DEFINE appName = 'WOTRACK';
    DEFINE sigOptionName = 'PMWRKTYP';
    DEFINE sigDesc='PM Work Types make Description Read Only';
    DEFINE grpName='ALLSITES';
    DEFINE condName='PMWRKTYP';
    DEFINE condDesc='PM Work Types make Description Read Only';
    DEFINE condClause='WORKTYPE=''PM'' and ISTASK=0';
    -- USER must define the last clause for the appropriate return result, property and propertyvalue.
    -- USER must also apply the sigoption in the application xml either through Application Designer or using an XML editor
    --Create NEW sigoption for this Conditional Expression
    Insert into SIGOPTION (APP, OPTIONNAME, DESCRIPTION, ESIGENABLED, VISIBLE, SIGOPTIONID, LANGCODE, HASLD) Values ('&&appName','&&sigOptionName','&&sigDesc', 0, 1, SIGOPTIONSEQ.nextval, 'EN', 0);
    -- add sigoption to security group and give rights
    Insert into APPLICATIONAUTH (GROUPNAME, APP, OPTIONNAME, APPLICATIONAUTHID) Values ('&&grpName', '&&appName', '&&sigOptionName', APPLICATIONAUTHSEQ.nextval);
    -- Create Conditional Expression
    Insert into CONDITION (CONDITIONID, CONDITIONNUM, DESCRIPTION, EXPRESSION, TYPE, NOCACHING) Values (CONDITIONSEQ.nextval, '&&condName','&&condDesc','&&condClause' , 'EXPRESSION', 1);
    -- Sig Option is applied in app xml, however needs to be added to ctrl tables as well
    -- add property control linking app, secrutiy group and sigoption
    insert into CTRLGROUP (APP, CTRLGROUPID, GROUPNAME, GROUPSEQ, OPTIONNAME) values ('&&appName', CTRLGROUPSEQ.nextval,'&&grpName', 10, '&&sigOptionName');
    --add prop ctrl linking Conditional Expression to sigoption
    insert into CTRLCONDITION (CONDITIONNUM, CONDITIONSEQ, CTRLCONDITIONID, CTRLGROUPID, REEVALUATE) values ('&&condName', 10, CTRLCONDITIONSEQ.nextval, (select CTRLGROUPID from CTRLGROUP where app='&&appName' and groupname='&&grpName' and optionname='&&sigOptionName'), 1);
    --add prop ctrl linking Conditional Expression to property control
    -- set conditionresult = True or False based on desired inputmode
    insert into CTRLCONDPROP (conditionresult, ctrlconditionid, ctrlcondpropid, property, propertyvalue)
    values (1, (select ctrlconditionid from CTRLCONDITION where ctrlgroupid in(select CTRLGROUPID from CTRLGROUP where app='&&appName' and optionname='&&sigOptionName' and CONDITIONSEQ='10')), CTRLCONDPROPSEQ.nextval, 'inputmode', 'readonly');

    ReplyDelete
  29. Hi,
    I have a validation class for a field. I am showing warning message if the data is not matching with the pattern. It works fine. But during bulk import, if field data in all the rows of file are incorrect, I am getting many pop ups one after another. I want to remove or suppress warning messages if its a bulk import. It should show only on manual entry from UI.. how can we get to know in field validation class if request is from a bulk import or UI

    ReplyDelete
    Replies
    1. i faced an issue similar this issue ,.
      Did you find any solution ?

      Delete
  30. Hi Mam/Sir, Is it possible to hide a select action dropdown list value when a specific filter is selected from the bookmarks? Thanks!

    ReplyDelete
  31. Hi Bruno,

    What options are there to prevent printing or running a po_print report if it isn't APPROVED? Without limiting the users to run other reports in the same application ( int his case: Purchase Orders)?

    regards,

    Dave

    ReplyDelete
  32. Hi,

    I have one requirement that once the Check Box is check one field needs to be defaulted with Number. Can we handle it by using conditional UI

    ReplyDelete
  33. Great site Bruno!

    I'm in the process of cleaning up my Maximo queries. I'm trying to limit which queries the users can see. Some are used on the start center, some just in the application, and some on both. I applied a data restriction to my security group FERMECH in the WOTRACK application. I can see my desired queries as well as some I don't want to see (certain start center queries) in the WOTRACK application drop down list when I log in as the user.

    Expression for data restriction:

    (:clausename like 'BFR%' or :clausename like 'AFR%' or :clausename like 'SFR%') AND :APP='WOTRACK'

    It doesn't seem like data restriction (alone) is working in this case. How would I go about applying the conditional piece to make this work so the
    user only see certain queries in the application as well as use certain
    on the start centers? or is this even possible?

    Thank you for your help,
    Marcus
    415-515-6380

    ReplyDelete