How to fill a custom field using a value submitted from JSM portal request create property panel?

I’m working on an app which requires me to use a Custom UI custom field on JSM Customer Portal. I have managed to get it to render by using the jiraServiceManagement:portalRequestCreatePropertyPanel, and to submit its value using view.submit(). The value gets saved as an entity property, but I also need it to fill a corresponding “real” custom field viewable in the issue that gets created in the Service management project when the Customer request gets submitted.

I have scoured the forums for a solution, but I found none. The only way I could think of achieving it is to fill the custom field from the entity property using a Trigger listening for the avi:jira:created/updated:issue event, but that seems quite convoluted.

Would my solution work? Is there a better one?

Related forum posts:

@ppasler I have seen that you have managed to solve this problem in your Awesome Custom Fields app, would you be willing to share some insight, please? :slight_smile:

1 Like

Hi @ViktorWolf ,

sure, will do. We have a “lazy” transmission function, which is triggered, when our property panel is called from the portal request.

The transmission moves the property values to the corresponding field values. Therefore your have to save the property values with the field keys (e.g. in a map style like this {customfield_123: "foo", customfield_456: "bar"}). As key for the whole property you might use the appId.

This is a really short description of what we do in the app. Hopes this helps!

Cheers,
paul

1 Like

Hello, thanks for your response!

So, if I’m understanding your explanation, the flow is like this:

  1. When a Customer request gets created, you submit the value along with information necessary for mapping to the custom field from the Request Create Property Panel.
  2. The customer gets redirected to their Request Detail, which causes your app to load and call the transmission function upon initialization. The transmission function presumably uses the REST API to fill the custom field.

Is that correct? If so, your solution wouldn’t be too dissimilar to the one I had in mind. Have you considered using Triggers when making your app? Can you think of any advantages or disadvantages to either approach?

Yes, your summary is correct :slight_smile:

We thought about triggers, but if i remember correctly, there hasn’t been suitable triggers by the time we implemented the functionality.

Our approach has problems when the request is created via API or automation, as there is no redirect to the portal view.

Cheers,
paul

1 Like

I was hoping there might be a more direct approach that I had missed, but I guess not. I think I’ll try with triggers first to see if it’s possible, and fall back to your method if it doesn’t work out.

Thanks again for the information :slight_smile:

1 Like