UI Kit 2 - Custom field edit on issue creation: onSubmit action

Hey there,

I am using UI Kit 2 to create the edit experience for a custom field type on the Create Issue View, like in the template project.

As the documentation states:

In create issue dialog, the onSubmit function in the Form component will be called on blur events, so you can place the submit logic there. Otherwise, you can create your own logic to use the submit API outside the onSubmit function.

This works and gets called after the form input has changed, but what do I do when I want to do something when the Issue is being saved?

The function does not get called again. In UI Kit 1 the onSubmit was only called when the Issue was saved.

Thank you!

1 Like

Hi @CPS

Thank you for reaching out. About the issue - I’m not sure I understand. Do you mean that with such experience the field’s value is being submitted every time there is a blur event and you’d like to implement some logic that only happens when the Create button is clicked in the create issue dialog and submit the field’s value after that?

Right now UI Kit 2 has a submit experience similar to the one in Custom UI. It actually uses the same submit API as a custom UI.

Hi @PawelRacki,

thanks for the reply.
Yes, I need to do some stuff with the field value that has side-effects (To be specific: I need to create Issue links). I used to do this in the onSubmit function in UI Kit 1, which only got called on “Issue Save”. Now it gets called onBlur. This is too early to Link the issues.

How can I perform something only when the actual value of my custom field is saved? Am I overlooking something?

I guess I could listen to the Issue Changed product event, but this would capture all Issue Changes and would not include the right context infos.

Hey again,

I think I got confused but now kind of solved it myself:

When renderContext === "issue-view" the onSubmit does not happen onBlur but when the submit button is pressed. This is the same behavior as with UI Kit 1. So I can perform the issue linking based on the renderContext.

For the issue-create renderContext even in UI Kit 1 I could not link issues, because the Key/ID of the newly created issue is not known at submit time.

So this is solved okay for me now, at least not worse than before. Now we could just turn it in to a future feature request to get some kind of event, when an App custom field is changed while creating an issue.

2 Likes

Hi again @CPS

Great to hear you figured it out! As you noticed, the submit experience in UI kit 2 is dependent on the render context. It’s almost the same experience as in Custom UI custom fields because developers need to use the same submit API in the app to submit the field’s value.

Paweł

1 Like