Menu

using oql to get the selected id

barakbar
2022-01-03
2022-01-27
  • barakbar

    barakbar - 2022-01-03

    Hello Everyone,,

    I'm in development stage, where I want to create a functionalci which is located in the user portal, then I want to create it, when the user selects a particular service, the specific assets for that service will appear.

    e.g:
    I have a service A, where depending on the ci I have entered 16 assets (functionalci), so when the user makes a request and the user enters asset(functionalci), 16 Assets (functionalci)which will appear and can be selected by the user.

    I have tried using this OQL in <scopes>
    SELECT FunctionalCI AS fci JOIN lnkFunctionalCIToService AS lnk ON lnk.functionalci_id = fci.id WHERE lnk.service_id = "'.$this->Get('service_id').'"</scopes>

    Thanks
    
     
  • Pierre Goiffon

    Pierre Goiffon - 2022-01-04

    Hello,
    Not sure I get it ?

    You mean 16 FunctionaliCI are associated with a Service
    If a user creates a UserRequest with this Service, then the 16 FunctionalCI should be also associated with the new UserRequest ?

     
  • barakbar

    barakbar - 2022-01-04

    Yes, 16 assets(functionalci) will appear in the asset(functionalci) selection form, but they are not selected automatically but the user making the request will be able to select 16 assets(functionalci)
    https://i.imgur.com/fUPHMlx.gif

    can use this?
    I have tried using this OQL in <scopes>
    SELECT FunctionalCI AS fci JOIN lnkFunctionalCIToService AS lnk ON lnk.functionalci_id = fci.id WHERE lnk.service_id = "'.$this->Get('service_id').'"</scopes>
    Or is there another way?
    Thanks

     

    Last edit: barakbar 2022-01-04
  • Pierre Goiffon

    Pierre Goiffon - 2022-01-27

    Hello,

    Many thanks for the gif, I understand better now !

    Don't change scopes for this ! Scopes are made solely to restrict user rights in the portal.

    You may take a look at the prefill methods ? See Form Prefill [iTop Documentation]

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-01-27

    Is this in your XML? In the XML you can't just suddenly add PHP.

    You'd need to change the last part to lnk.service_id = :this->service_id

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.