Do you know how to set default value for service, service subcategory, impact and urgency in the request form in the portal ?
And then hide them ?
I tried with this but it failed :
<?xml version="1.0" encoding="UTF-8"?><itop_designxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"version="1.0"><module_designs><module_designid="itop-portal"xsi:type="portal"><bricks><brickid="services"xsi:type="Combodo\iTop\Portal\Brick\BrowseBrick"><active_delta="redefine">false</active></brick><brickid="quick-new-user-request"xsi:type="Combodo\iTop\Portal\Brick\CreateBrick"_delta="define"><active>true</active><rank><default>9</default></rank><width>6</width><modal>true</modal><title><default>Brick:Portal:QuickNewUserRequest:Title</default></title><description>Brick:Portal:QuickNewUserRequest:Description</description><visible><home>true</home></visible><decoration_class><default>fafa-boltfa-2xfa-fw</default></decoration_class><!-- Class that will be create created with the form --><class>UserRequest</class><rules><ruleid="contact-to-userrequest"/><ruleid="preset-service-subservice-impact-urgency"/></rules></brick></bricks><action_rules><action_ruleid="preset-service-subservice-impact-urgency"><presets><!-- Only set() and copy() are supported for now --><presetid="1">set(service_id,1)</preset><presetid="2">set(subcategory_id,55)</preset><presetid="8">set(impact,3)</preset><presetid="9">set(urgency,4)</preset></presets><retrofits/></action_rule></action_rules></module_design></module_designs></itop_design>
Thanks for your reply
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Presetting fields
The usage of an action rule like you deal seems good, that the proper way to preset fields when creating an object in the portal.
The only thing that could be wrong is the subcategory_id that is not a regular field, in the standard datamodel it's servicesubcategory_id but maybe you changed your datamodel?
How are you applying the XML delta, through an extension? Because I don't see any _delta="XXX" attributes on the nodes.
What is your symptom exactly?
Hidding fields
In the portal, for a specific class you can design a form for the object creation, edition, viewing, transitions. So in your case, I think the best way would be to change the edit (and view?) form to remove the impact and urgency fields.
In the standard datamodel there are defined in the /module_designs/module_design[@id="itop-portal"]/forms/form[@id="ticket-edit"]/twig
If your alter this form, the changes will occurs on all the classes derivated from Ticket (UserRequest, Incident, ...). If you prefer to change only the UserRequest form, you can add a new form node dedicated to the UserRequest class.
Guillaume
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
<?xml version="1.0" encoding="UTF-8"?><itop_designxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"version="1.0"><module_designs><module_designid="itop-portal"xsi:type="portal"><bricks><brickid="services"xsi:type="Combodo\iTop\Portal\Brick\BrowseBrick"><active_delta="redefine">false</active></brick><brickid="quick-new-user-request"xsi:type="Combodo\iTop\Portal\Brick\CreateBrick"_delta="define"><active>true</active><rank><default>9</default></rank><width>6</width><modal>true</modal><title><default>Brick:Portal:QuickNewUserRequest:Title</default></title><description>Brick:Portal:QuickNewUserRequest:Description</description><visible><home>true</home></visible><decoration_class><default>fafa-boltfa-2xfa-fw</default></decoration_class><!-- Class that will be create created with the form --><class>UserRequest</class><rules><ruleid="contact-to-userrequest"/><ruleid="preset-service-subservice-impact-urgency"/></rules></brick></bricks><action_rules><action_ruleid="preset-service-subservice-impact-urgency"_delta="define"><presets><!-- Only set() and copy() are supported for now --><presetid="1">set(service_id,1)</preset><presetid="2">set(servicesubcategory_id,55)</preset><presetid="3">set(impact,3)</preset><presetid="4">set(urgency,4)</preset></presets><retrofits/></action_rule></action_rules><forms><formid="ticket-create"_delta="must_exist"><class>Ticket</class><fields/><twig_delta="redefine"><divclass="row"style="display: none"><divclass="col-sm-6"><divclass="form_field"data-field-id="service_id"data-field-flags="mandatory"></div></div><divclass="col-sm-6"><divclass="form_field"data-field-id="servicesubcategory_id"data-field-flags="mandatory"></div></div></div><divid="service_details_placeholder"_altered_in="itop-request-template-portal"><divclass="form_field"data-field-id="service_details"></div></div><divclass="row"style="display: none"><divclass="col-sm-6"><divclass="form_field"data-field-id="impact"></div></div><divclass="col-sm-6"><divclass="form_field"data-field-id="urgency"></div></div></div><div><divclass="form_field"data-field-id="title"></div><divclass="form_field"data-field-id="description"></div><divclass="form_field"data-field-id="contacts_list"></div></div></twig><modes><!-- mode id can among create / edit / view --><modeid="create"/></modes></form><formid="ticket-edit"_delta="must_exist"><class>Ticket</class><properties><!--Display mode of the form fields. "cosy" for a regular labels over values layout; "compact" for a side-by-side layout with input aligned; "dense" for a side-by-side layout with input filling all available space. You can also use a custom css class that will be used on the form as "form_xxx", as well as on the fields as "form_field_xxx".--><!--<display_mode>cosy</display_mode>--><!-- When set to false, submit button is hidden when transitions are available on the object (in edit mode only). Default is false. --><!--<always_show_submit>false</always_show_submit>--></properties><fields/><twig_delta="redefine"><divclass="row"style=""><divclass="col-sm-7"><fieldset><legend>{{'Ticket:baseinfo'|dict_s}}</legend><divclass="col-sm-6"><divclass="form_field"data-field-id="title"data-field-flags="read_only"/><divclass="form_field"data-field-id="service_id"data-field-flags="read_only"/></div><divclass="col-sm-6"><divclass="form_field"data-field-id="caller_id"data-field-flags="read_only"/><divclass="form_field"data-field-id="servicesubcategory_id"data-field-flags="read_only"/></div><divclass="col-sm-12"><divclass="form_field"data-field-id="description"data-field-flags="read_only"/><divclass="form_field"data-field-id="solution"data-field-flags="read_only"/></div><divclass="col-sm-6"><divclass="form_field"data-field-id="user_satisfaction"data-field-flags="read_only"/></div><divclass="col-sm-6"><divclass="form_field"data-field-id="user_comment"data-field-flags="read_only"/></div></fieldset></div><divclass="col-sm-5"><fieldset><legend>{{'Ticket:Type'|dict_s}}&{{'Ticket:date'|dict_s}}</legend><divclass="col-sm-6"><divclass="form_field"data-field-id="status"data-field-flags="read_only"/><divclass="form_field"data-field-id="impact"data-field-flags="read_only"/><divclass="form_field"data-field-id="urgency"data-field-flags="read_only"/><divclass="form_field"data-field-id="priority"data-field-flags="read_only"/></div><divclass="col-sm-6"><divclass="form_field"data-field-id="start_date"data-field-flags="read_only"/><divclass="form_field"data-field-id="last_update"data-field-flags="read_only"/><divclass="form_field"data-field-id="resolution_date"data-field-flags="read_only"/><divclass="form_field"data-field-id="agent_id"data-field-flags="read_only"/></div></fieldset></div></div><div><divclass="form_field"data-field-id="contacts_list"/><divclass="form_field"data-field-id="public_log"/></div></twig><modes><modeid="edit"/><modeid="view"/></modes></form></forms></module_design></module_designs></itop_design>
Thanks @Guillaume for your help !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yep that is it! Keep in mind that you can either modify the Ticket form if you want the change to apply on all derivated classes or duplicate it only for the UserRequest.
Glad it helped!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello all,
Do you know how to set default value for service, service subcategory, impact and urgency in the request form in the portal ?
And then hide them ?
I tried with this but it failed :
Thanks for your reply
Hi Sebastian,
Presetting fields
The usage of an action rule like you deal seems good, that the proper way to preset fields when creating an object in the portal.
The only thing that could be wrong is the subcategory_id that is not a regular field, in the standard datamodel it's servicesubcategory_id but maybe you changed your datamodel?
How are you applying the XML delta, through an extension? Because I don't see any _delta="XXX" attributes on the nodes.
What is your symptom exactly?
Hidding fields
In the portal, for a specific class you can design a form for the object creation, edition, viewing, transitions. So in your case, I think the best way would be to change the edit (and view?) form to remove the impact and urgency fields.
In the standard datamodel there are defined in the /module_designs/module_design[@id="itop-portal"]/forms/form[@id="ticket-edit"]/twig
If your alter this form, the changes will occurs on all the classes derivated from Ticket (UserRequest, Incident, ...). If you prefer to change only the UserRequest form, you can add a new form node dedicated to the UserRequest class.
Guillaume
Hi Guillaume,
Yes, I'm using an extension.
I replaced subcategory_id by servicesubcategory_id and I added delta="define" like this :
And now it works correctly !
Thanks you so much !
About Hidding fields
I understand what you explain, but I don't know from where to start ...
Should I write it in the same XML file of my extension ?
Finally I found by myself :
Thanks @Guillaume for your help !
Yep that is it! Keep in mind that you can either modify the Ticket form if you want the change to apply on all derivated classes or duplicate it only for the UserRequest.
Glad it helped!