Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

create a problem

tushar_ghadage
Tera Contributor

Hi guys, 

I have a functionality where, I have interaction record

and there is UI action called 'create an incident' when one clicks on this 

incident will get created and I want to update the work notes as 'created from interaction and record no:'.

and vice versa on incident as well.

 

how can I do this using flow designer?? 

 

not sure can anyone help??

2 REPLIES 2

SumanthDosapati
Mega Sage

@tushar_ghadage 

Do you mean this functionality of UI action is already present? or do you want to create it now?

 

Regards,

Sumanth

its already present code which I modified as seen below:

var canCreateIncident = false;
if ((current.isNewRecord() && current.canCreate()) || (!current.isNewRecord() && current.canWrite()))
    canCreateIncident = current.update();
else
    canCreateIncident = true;

if (canCreateIncident) {
    var inc = new GlideRecord("incident");
    inc.initialize();
    inc.caller_id = current.opened_for;
    inc.short_description = current.short_description;
    if (GlidePluginManager.isActive("sn_itsm_gen_ai") && current.chat_summary && (current.chat_summary.toString()).length < 4000) {
        inc.description = current.chat_summary;
    }
    inc.origin_table = "interaction";
    inc.origin_id = current.sys_id;
    if (gs.getProperty("com.snc.incident.create_from_interaction.save") === 'true') {
        inc.work_notes = gs.getMessage('Incident created from Interaction {0}', current.number);
        var incSysId = inc.insert();
        if (incSysId) {
            var interactionRelatedGR = new GlideRecord("interaction_related_record");
            interactionRelatedGR.initialize();
            interactionRelatedGR.interaction = current.sys_id;
            interactionRelatedGR.document_table = 'incident';
            interactionRelatedGR.document_id = incSysId;
            interactionRelatedGR.insert();
        }
    }
    action.openGlideRecord(inc);
    new InteractionRelationshipUtil().copyAttachments(current, inc);

    var flowInputs = {};
flowInputs['current'] = current;
flowInputs['interaction'] = current.getTableName();

var result = sn_fd.Flow.startAsync('from intraction to incident', flowInputs);
when that triggers  i want to update the incident record with work notes and vice versa.