How to submit value of JSM module?

Hello there,

I have added jiraServiceManagement:portalRequestCreatePropertyPanel to customer portal form as below:

This is the <Select /> component in the form:

I want to use that selected value in the jiraServiceManagement:portalRequestDetail module. However, value is not submitted to anywhere.

This is my manifest file:

modules:
  jiraServiceManagement:portalRequestCreatePropertyPanel:
    - key: aip-forge-jsm-panel-property
      name: Forge Assets Portal
      resource: portal-create-property
      render: native
      resolver:
        function: resolver
  jiraServiceManagement:portalRequestDetail:
    - key: aip-forge-jsm-portal-detail
      title: Forge Assets Portal Request Detail
      resource: portal-view-property
      render: native
      resolver:
        function: resolver
  function:
    - key: resolver
      handler: index.handler
resources:
  - key: portal-create-property
    path: src/frontend/index.jsx
  - key: portal-view-property
    path: src/frontend/view/index.jsx

This is the scopes defined:

permissions:
  scopes:
    - admin:connect-jira
    - read:connect-jira
    - write:connect-jira
    - act-as-user:connect-jira
    - manage:jira-configuration
    - read:custom-field-contextual-configuration:jira
    - write:custom-field-contextual-configuration:jira
    - read:jira-work
    - write:jira-work
    - read:servicedesk-request
    - write:servicedesk-request

As you see, property is undefined:

I also tried to get property via Jira Rest API, but it adds my app id to the endpoint and it returns 404.

  const issueResponse = await api
        .asApp()
        .requestJira(
            route`/rest/api/3/issue/${issueKey}/properties`
        );

Thanks in advance!
Furkan,

Hi @AbdulbakiFurkanTanrv ,

TBH, that’s a bit of pain :slight_smile:

You can retrieve the issue property value via API and then display it in your jiraServiceManagement:portalRequestDetailPanel.

Make sure that you call the API in the Forge backend asApp if you want it to work with customers and not just Jira users.

Hope this helps!
Cheers,
paul

2 Likes

Hi @ppasler ,

Thank you for your answer!

Edit:
I think this is the answer for UI Kit & Custom UI:

The view.submit method can be invoked every time the fields in the Forge portal request create property panel form is updated. The field data would be store in the Jira issue property when the request form is submitted.

Once the portal request creation form is saved, the data stored using the jiraServiceManagement:portalRequestCreatePropertyPanel module can be retrieved from the extension context of jiraServiceManagement:portalRequestDetail.

The problem is when/how to invoke view.submit to save the value of my component to jira issue properties.

Kind regards,
Furkan

Solved

Hello @AbdulbakiFurkanTanrv , I am stuck at the same step trying to figure out how to invoke view.submit , will you be able to share how did you manage to submit value to a property?

thanks in advance.

Hi @Vikram1 ,

The issue was caused by an incorrect object structure in my submission.

The following code resolved the problem:

    const onSubmit = async (option) => {
        console.log("option", option);
        await view.submit({fields: [{key: "aip-forge-jsm-form", value: option}], isValid: true})
    }

Best regards,
Furkan

1 Like

Fantastic, works like a charm!

Thanks a lot.

Happy to hear that :+1: :slight_smile:

1 Like