Flag a comment On Ticket Edit

I am attempting to have a flag on the Edit Ticket form that is attached to the comment. Basically I added a field in the Comments list that is a Response Required Yes/No flag. I'd like to set it at the Edit Ticket level so if they flip the toggle to yes it stores that in the Comment list. Is there a way to submit it on the submit of the ticket edit?

Hello! I will consult with developers and get back to this topic soon.

So, here is the solution prepared for you by developers.

function getConfig() {
    var propertyKey = 'Plumsail.HD.Configuration';
    var storageKey = propertyKey + '.' + _spPageContextInfo.siteId + '.' + _spPageContextInfo.webId;

    return pnp.sp.web.allProperties
        .usingCaching({
            expiration: new Date((new Date()).getTime() + (10 * 60 * 1000)),
            key: storageKey,
            storeName: 'local'
        })
        .select(propertyKey)
        .get().then(function (webProperties) {
            return JSON.parse(webProperties[propertyKey.split('.').join('_x002e_')])
                .Config;
        });
}

function getTicketInfo(list) {
    return list.items
        .getById(fd.itemId)
        .select('TicketGuid')
        .get()
        .then(function (ticketInfo) {
            return ticketInfo;
        });
}

function getContactInfo(list, ticket) {
    return list.items
        .filter('TicketGuid eq \'' + ticket.TicketGuid + '\'')
        .orderBy('ID', false)
        .select('ID')
        .top(1)
        .get()
        .then(function (contactInfo) {
            return contactInfo[0];
        });
}

function setCommentResponseRequired() {
    return getConfig().then(function (cfg) {
        var commentsList = pnp.sp.web.lists.getById(cfg.CommentsListId);
        var ticketsList = pnp.sp.web.lists.getById(cfg.TicketsListId);
        getTicketInfo(ticketsList)
            .then(function (ticket) {
                getContactInfo(commentsList, ticket)
                    .then(function (comment) {
                        commentsList
                            .items
                            .getById(comment.ID)
                            .update({
                                ResponseRequired: commentResponseRequired
                            });
                    });
            });
    });
}
var commentResponseRequired = null;
fd.spSaved(setCommentResponseRequired);
fd.spBeforeSave(function () {
    commentResponseRequired = fd.field('CommentResponseRequired').value;
});
  • Save the changes, reload the HelpDesk site with Ctr+F5 and check how it works. If you switch the toggle to "Yes", it will set the "ResponseRequired" column to "Yes" for the currently submitted comment.