Menu

Use AttributeExternalKey field on Enhanced Customer Form

Kevin
2022-09-14
2022-09-15
  • Kevin

    Kevin - 2022-09-14

    Hello to all !

    I have added a AttributeExternalKey field linked to a AttributeExternalField field.
    The Key is a filter to the current Organization 'in production' contracts.
    The Field is a link between Contract ID and its Name.

    In the console portal all works perfectly. The field is, by default, empty and when the Organization is selected the field is populated with the correct contracts.

    But in the enhanced customer portal, I do not managed to show this field on the request form.
    Indeed, when I add it, the form redirect to a 404 error.

    The XML fields:

    <field id="contract_id" xsi:type="AttributeExternalKey" _delta="define">
      <filter>
        <![CDATA[
          SELECT Contract AS C
          WHERE C.org_id = :this->org_id AND C.status = 'production'
        ]]>
      </filter>
      <dependencies>
        <attribute id="org_id"/>
      </dependencies>
      <sql>contract_id</sql>
      <target_class>Contract</target_class>
      <is_null_allowed>false</is_null_allowed>
      <on_target_delete>DEL_MANUAL</on_target_delete>
      <allow_target_creation>false</allow_target_creation>
      <display_style>list</display_style>
    </field>
    <field id="contract_name" xsi:type="AttributeExternalField" _delta="define">
      <extkey_attcode>contract_id</extkey_attcode>
      <target_attcode>name</target_attcode>
    </field>
    

    The form Twig:

    <twig>
        <div class="row">
            <div class="col-sm-6">
                <div class="form_field" data-field-id="contract_id" data-field-flags="mandatory"></div>
            </div>
            <div class="col-sm-6">
                <div class="form_field" data-field-id="service_type" data-field-flags="mandatory"></div>
            </div>
        </div>
        <div id="service_details_placeholder"></div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form_field" data-field-id="impact"></div>
            </div>
            <div class="col-sm-6">
                <div class="form_field" data-field-id="urgency"></div>
            </div>
        </div>
        <div>
            <div class="form_field" data-field-id="title"></div>
            <div class="form_field" data-field-id="description"></div>
            <div class="form_field" data-field-id="contacts_list"></div>
        </div>
    </twig>
    

    You could see the error on attachment.
    Error translation:
    Page not found
    Sorry this object does not exist (or you are not authorized to display it)

    Kind regards,

     

    Last edit: Kevin 2022-09-14
  • Vincent @ Combodo

    Hi Kevin
    I have the feeling to have seen a kind of limitation by which you cannot define a dependency on a field which is not present in the form. Could you try to add the "org_id" in the form, in read only if you want, (maybe in hidden, it might work as well, but less sure..)

     
  • Kevin

    Kevin - 2022-09-14

    Hi Vincent,

    Thank you for your answer. I have tried your solution without result.
    I have the same 404 error...

    Kind regards,

     
  • Vincent @ Combodo

    Is the Portal User allowed to see the remote object through his scopes?
    Some customer reported a similar issue when an object is pointing to an archived object, then the Portal is no more able to display the container object. That could be the same cause.

     

    Last edit: Vincent @ Combodo 2022-09-15

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.