Make body field not mandatory?

Hello,

is it possible to make the body field (comment) not mandatory while create a ticket?
In the list settings it is marked as not mandatory, in spforms it is marked as not required, but i can't save a ticket without this field filled.

The customer writes the problem in another field called problem-description that i have created.
I want to use the body field only for the conversation with the customer after the ticket is created.

Thanks!

Daniel

Hello Daniel! I need to consult with developers on the issue. Before I get any results, could you let me know whether using a space character as an initial comment in the Body field or duplicating the issue description in it would work for you?

Thanks. Please inform me if you have a answer from the dev-team.

For now i already duplicated the field to the issue description. It bothers that the fields are the same and shows up.
Another solution could be to disable the first body item after copy it to the issue description.

And what about an "empty" initial comment? I mean if to use the space character as its contents. The task is quite tricky and requires some code developing. Perhaps, the "invisible" contents of the initial comment would work for you?

We got two helpdesks where we needed a similiar workaround. Since you mentioned another textfield in your default form I suspect that you use Plumsail Forms too. We solved this like suggested by @Evgeniy like:
fd.spRendered(function() {
ticketForm.Render();
fd.field('Body').ready().then(function() {
fd.field('Body').value = " ";
});
});

1 Like

Well, here is a possible solution.

  1. Open tickets forms for customization in Forms.
  2. Add the following JS code to the New form and save it (find the fd.spRendered() in the default code and extend its content):
fd.spRendered(function() {
    ticketForm.Render().then(function(){
        fd.field('Body').required = false;
        $(fd.field('Body').$parent.$el).hide();
    });
});


It will hide the Body field and make it unrequired. But form submission will anyway create an initial comment containing a null string visible in Edit and Display forms:
image
3. Use this style in both forms to hide it and save them:

.comment:last-child {
    display: none;
}


It will hide the initial comment from the form:
image

Note: the initial null comment will remain in the notifications when you render all comments for the current ticket. You might either set it to a space character as suggested @mrFaulwurf (or some neutral string like "Beginning of the discussion") or design a complex template not to include it in the notification.

Thanks for now guys. I will figure out which would be the best practice for our needs. :ok_hand:

Hello again,

i tried the solution:

fd.spRendered(function() {
    ticketForm.Render().then(function(){
        fd.field('Body').required = false;
        $(fd.field('Body').$parent.$el).hide();
    });
});

It worked.

But how can i set a neutral string like "Beginning of the discussion". The approach from @mrFaulwurf does not work for me. It gives me an error that the Body-Field is missing.

fd.spRendered(function() {
   ticketForm.Render();
   fd.field('Body').ready().then(function() {
   fd.field('Body').value = " ";
   });
});

Any ideas?

Hello Daniel,

It seems that retrieving canned responses hinders implementing the approach suggested by @mrFaulwurf. I would advise you to use the following code:

fd.spRendered(function () {
    ticketForm.Render().then(function () {
        fd.field('Body').required = false;
        // Uncomment the line below to hide the "Body" field
        //$(fd.field('Body').$parent.$el).hide();
    });
});

fd.spBeforeSave(function () {
    fd.field('Body').ready().then(function () {
        fd.field('Body').value = "Default body.";
    });
});

Hello @Evgeniy ,

i think the code provided is not longer working with the new form:

fd.spRendered(function () {
    ticketForm.Render().then(function () {
        fd.field('Body').required = false;
        // Uncomment the line below to hide the "Body" field
        //$(fd.field('Body').$parent.$el).hide();
    });
});

fd.spBeforeSave(function () {
    fd.field('Body').ready().then(function () {
        fd.field('Body').value = "Default body.";
    });
});

At least it saves but does not trigger anything.

I think it is because of the

{
  "component": "comment-editor",
  "props": {}
}

Hello Daniel! Unfortunately, I could not modify the code to make it working. I will enquire of developers about this issue and post the result here.

Daniel, the code stopped working due to changes in the internal comment validator. Developers will fix it, I will notify you once it is done.

Hello Daniel! Please ensure that you use the latest version of HelpDesk (2.1.31) and framework package (1.1.3), then you can use the code below:

/*Write your custom JavaScript here*/

/*DO NOT remove the code below. You need this for the correct work of your forms.*/
window.Plumsail.HelpDesk.Forms.register('ticket', fd, pnp, $, Dialog, Vue);

fd.hdFormReady(function() {
    // Disable field
    fd.field('Body').required = false;
    // Set Default value
    fd.field('Body').ready().then(function () {
        fd.field('Body').value = "Default body.";
    });
});

To hide the field, please use a custom class and styles: