Hi,
I wrote an extension to customize the Portal. I created a brick to show the CIs owned by the logged in user:
<bricks><brickid="NM_cis"xsi:type="Combodo\iTop\Portal\Brick\BrowseBrick"_delta="define"><active>true</active><rank><default>70</default></rank><title><default>MyownCIs</default></title><levels><levelid="10"><oql><![CDATA[ SELECT FunctionalCI AS fci JOIN lnkContactToFunctionalCI AS lnk ON lnk.functionalci_id = fci.id WHERE lnk.contact_id = :current_contact->id ]]></oql><fields><fieldid="org_id"></field></fields><actions><actionid="view"xsi:type="view"><rank>1</rank></action><actionid="create_from_this"xsi:type="create_from_this"><class>UserRequest</class><icon_class>fcfc-new-requestfc-1-6xfc-flip-horizontal</icon_class><rank>2</rank>-->
<rules><ruleid="contact-to-userrequest"/><ruleid="go-to-open-request-on-submit"/></rules></action></actions>...
I added an action to create a UserRequest out of the CI (even with prefilling some fields).
Now I am searching for a way to add the CI to the UserRequest.
At the moment the Ticket is created but without any relationship to the CI.
I have not found any Attribute or Placeholder to add the CI to the Request yet.
It would be great if someone could give me a hint how to get the CI's name into the UserRequest (or the functionalcis_list ideally).
Many thanks in advance,
Nico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Pierre,
thanks for your reply.
I'm not sure if we mean the same thing.
For example: A user has 3 (or more) CIs that he can see in his portal (using the new extension mentioned above). Now he has a problem with one of his CIs and chooses it in the potal to open a request.
The request will be opened but without any relationship to the CI.
If I use the automatic-object-creation extension, it could be triggered on opening a request, but how does it know about the CI that the user had choosed in his portal? In addition it should only be triggered if used in conjunction with the "my own CIs" extension in the portal.
Thanks again for your time.
Best regards,
Nico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
This extension allows to create an action, in your use case it would be create a new UserRequest from a CI instance. Take a look at the documentation, give the extension a try, you will see quickly how it works :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
sorry, I dont get it.
I already used the extension to automatically create Workorders if a UserRequest is raised or to add Documents on a newly created CI/PC.
But I don't see the relationship on how to create a rule that adds the users CI to the UserRequest if he creates a new UserRequest out of the list of his CIs, in the portal.
I dont want to create a new or another object when raising a UserRequest.
I only want to add the name of the selected CI or link it directly when the request is opened (to the functionalcis_list).
This is really frustrating since I already realised a lot in customizing iTop.
I hope you could give me another hint.
Many thanks in advance,
best regards,
Nico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Not sure to understand either ? I guessed that the user opens up in the user portal a list of CI, and needs to open a new UserRequest from one of this CI : in this case he could just opens the CI and use an action button that will trigger the Configurator for automatic object creation extension rule, that will create a new UserRequest with the CI attached.
You might explain one or more use cases so that we can have a better idea of what you want to do ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Pierre,
that's exactly what I try. I already have a rule for creating a UserRequest out of a CI. It is shown in the menu "Other Action" in the Backend but not when I open the CI in the Portal (as configured shown in my 1st Post).
In the Portal I only got the Burger Menu next to the CI with 2 actions: "Details" and "New User Reqest", but that "New User Request" belongs to the --action id="create_from_this"-- declaration.
How can I get the Menu from the automatic object creation extension rule visible here?
Thanks again so much for your time,
best regards,
Nico
All my apologies the Configurator for automatic object creation extension doesn't provide anything for the use rportal indeed, it is limited to the admin console.
For the portal, you could try to use action rules ?
The syntax is similar to the one used in the extension.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Pierre,
ok, I already did some experiments with the action rules. But I dont know how to get any ID from the viewed CI.
I only found out to have access to the username of the current logged in user and that origin is "portal".
But I can't find any relationship between the called/viewed functionalCI and the UserRequest opened by "create-from-this".
I succeeded in setting attributes (vie PrefillCreationForm function) that are shown in the creation form (service, service subcat, impact, urgency, title and description) but don't know how to get the functional_ci ID from the current viewed CI and set it in the creation form.
Have a nice weekend,
best regards,
Nico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Pierre,
i already had a look at that file. From there I got the "create_from_this" action.
Now I added a field to the creation form to add the functional-ci:
I can see the functionalcis_list and manually select a CI owned by the portal user.
To automatically add it I created this action rule:
<action_ruleid="NM_set-for-own-ci"_altered_in="hkt-portal-customization"><source_oql><![CDATA[SELECT FunctionalCI AS fci WHERE id = :this->id]]></source_oql><presets><presetid="1">add_to_list(id,functionalcis_list)</preset></presets></action_rule>
But when I select "create request" in the portal I get this error:
Missing query argument: expecting = this->id, available = {0=>current_contact_id; 1=>current_user->object(); 2=>current_contact->object()}
If I set an id in the OQL Query the CI is added to the list. But I don't know how to get the ID automatically.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But I get this error message:
Some action rules were not executed(destination object: UserRequest[-1]): NM_set-for-own-ci = Portal query was stopped: action_rule 'NM_set-for-own-ci' searches for 'FunctionalCI' without any condition is forbidden
Ok
You're executing this from a browse brick right ?
You already paste some XML in the thread, but to sum up can you upload the complete XML file to reproduce this on a standard iTop community version ? @glajarige might be able to help with this :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Pierre,
I found out that changing this two things makes the rule working for CIs of type PC:
1) changing source_class from "FunctionalCI" to "PC"
2) changing preset id 1 from "copy(id, functionalcis_list)" to "add_to_list(id, functionalcis_list)"
But, in the Portal different types of FunctionalCIs are shown, not only PC. Maybe some CIs of type Peripheral, too.
If I try to open a UserRequest on this I of course get an error because the rule has its source in class PC, not Peripheral.
So the best would be setting the source_class in the rule to "FunctionalCI" but that throws an error too.
Maybe this helps to find a solution on opening UserRequests out of a CI with the specific CI automatically attached to the UR.
Thanks,
best regards,
Nico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I wrote an extension to customize the Portal. I created a brick to show the CIs owned by the logged in user:
I added an action to create a UserRequest out of the CI (even with prefilling some fields).
Now I am searching for a way to add the CI to the UserRequest.
At the moment the Ticket is created but without any relationship to the CI.
I have not found any Attribute or Placeholder to add the CI to the Request yet.
It would be great if someone could give me a hint how to get the CI's name into the UserRequest (or the functionalcis_list ideally).
Many thanks in advance,
Nico
Hello,
You should take a look at this extension, I think it does exactly what you are trying to do : https://store.itophub.io/en_US/products/combodo-configurator-for-automatic-object-creation
Hi Pierre,
thanks for your reply.
I'm not sure if we mean the same thing.
For example: A user has 3 (or more) CIs that he can see in his portal (using the new extension mentioned above). Now he has a problem with one of his CIs and chooses it in the potal to open a request.
The request will be opened but without any relationship to the CI.
If I use the automatic-object-creation extension, it could be triggered on opening a request, but how does it know about the CI that the user had choosed in his portal? In addition it should only be triggered if used in conjunction with the "my own CIs" extension in the portal.
Thanks again for your time.
Best regards,
Nico
Hello,
This extension allows to create an action, in your use case it would be create a new UserRequest from a CI instance. Take a look at the documentation, give the extension a try, you will see quickly how it works :)
Hi,
sorry, I dont get it.
I already used the extension to automatically create Workorders if a UserRequest is raised or to add Documents on a newly created CI/PC.
But I don't see the relationship on how to create a rule that adds the users CI to the UserRequest if he creates a new UserRequest out of the list of his CIs, in the portal.
I dont want to create a new or another object when raising a UserRequest.
I only want to add the name of the selected CI or link it directly when the request is opened (to the functionalcis_list).
This is really frustrating since I already realised a lot in customizing iTop.
I hope you could give me another hint.
Many thanks in advance,
best regards,
Nico
Hello,
Not sure to understand either ? I guessed that the user opens up in the user portal a list of CI, and needs to open a new UserRequest from one of this CI : in this case he could just opens the CI and use an action button that will trigger the Configurator for automatic object creation extension rule, that will create a new UserRequest with the CI attached.
You might explain one or more use cases so that we can have a better idea of what you want to do ?
Hi Pierre,
that's exactly what I try. I already have a rule for creating a UserRequest out of a CI. It is shown in the menu "Other Action" in the Backend but not when I open the CI in the Portal (as configured shown in my 1st Post).
In the Portal I only got the Burger Menu next to the CI with 2 actions: "Details" and "New User Reqest", but that "New User Request" belongs to the --action id="create_from_this"-- declaration.
How can I get the Menu from the automatic object creation extension rule visible here?
Thanks again so much for your time,
best regards,
Nico
Hello,
All my apologies the Configurator for automatic object creation extension doesn't provide anything for the use rportal indeed, it is limited to the admin console.
For the portal, you could try to use action rules ?
The syntax is similar to the one used in the extension.
Hi Pierre,
ok, I already did some experiments with the action rules. But I dont know how to get any ID from the viewed CI.
I only found out to have access to the username of the current logged in user and that origin is "portal".
But I can't find any relationship between the called/viewed functionalCI and the UserRequest opened by "create-from-this".
I succeeded in setting attributes (vie PrefillCreationForm function) that are shown in the creation form (service, service subcat, impact, urgency, title and description) but don't know how to get the functional_ci ID from the current viewed CI and set it in the creation form.
Have a nice weekend,
best regards,
Nico
Check the action_rules that are present in the default datamodel. You'll find some in
datamodels\2.x\itop-tickets\datamodel.itop-tickets.xml
Hi Pierre,
i already had a look at that file. From there I got the "create_from_this" action.
Now I added a field to the creation form to add the functional-ci:
I can see the functionalcis_list and manually select a CI owned by the portal user.
To automatically add it I created this action rule:
But when I select "create request" in the portal I get this error:
Missing query argument: expecting = this->id, available = {0=>current_contact_id; 1=>current_user->object(); 2=>current_contact->object()}
If I set an id in the OQL Query the CI is added to the list. But I don't know how to get the ID automatically.
Hello,
Try using source_class instead of source_oql ?
This is how it is done in the servicesubcategory-to-userrequest action rule (see https://github.com/Combodo/iTop/blob/develop/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml#L1468)
Hi Pierre,
I also tried that already:
But I get this error message:
Some action rules were not executed(destination object: UserRequest[-1]): NM_set-for-own-ci = Portal query was stopped: action_rule 'NM_set-for-own-ci' searches for 'FunctionalCI' without any condition is forbidden
Ok
You're executing this from a browse brick right ?
You already paste some XML in the thread, but to sum up can you upload the complete XML file to reproduce this on a standard iTop community version ?
@glajarige might be able to help with this :)
Hi Pierre,
I found out that changing this two things makes the rule working for CIs of type PC:
1) changing source_class from "FunctionalCI" to "PC"
2) changing preset id 1 from "copy(id, functionalcis_list)" to "add_to_list(id, functionalcis_list)"
But, in the Portal different types of FunctionalCIs are shown, not only PC. Maybe some CIs of type Peripheral, too.
If I try to open a UserRequest on this I of course get an error because the rule has its source in class PC, not Peripheral.
So the best would be setting the source_class in the rule to "FunctionalCI" but that throws an error too.
Maybe this helps to find a solution on opening UserRequests out of a CI with the specific CI automatically attached to the UR.
Thanks,
best regards,
Nico
Hi,
yes, I use a browse brick.
Attached you can find the complete XML file.
Many thanks for your time.
Hi,
do you have any update for this case?
It would be really helpful.
Thanks,
best regards,
Nico
can these functionalci be mandatory? how?
Plz have a look at: https://www.itophub.io/wiki/page?id=2_7_0:customization:mandatory-in-portal