Home Self-Service Portal - Community

Change status on File Attachment for End users

Hello,

Is it possible to change status of a request when the file is uploaded. I have the below given scenario:

Let's say request is in XYZ status. Whenever user uploads any file, the status remains XYZ. My requirement is when the file is uploaded, status of the request should be changed to Active.

Thanks in Advance,

Manas Gautam

Answers

  • Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    This is a great idea! Here's a bit of js you can add to custom.js that will accomplish what you are after:


    app.custom.formTasks.add('Incident', null, function (formObj, viewModel) { 

    if (_.has(viewModel, 'FileAttachment')) {

    viewModel.FileAttachment.bind('change', function(evt){

    if (evt.action === 'add' && viewModel.Status.Id !== '5e2d3932-ca6d-1515-7310-6f58584df73e') {

    var status = {

    Id: "5e2d3932-ca6d-1515-7310-6f58584df73e",

    Name: "Active"

    };

    viewModel.set('Status', status);

    }

    });

    }

    });

  • Manas_GautamManas_Gautam Customer IT Monkey ✭

    Hello Justin,

    Thanks for your response.

    This code works fine but there's an issue. If the user is attaching the file for the first time, this block of code does not get executed. It works only when there is at least one existing attached file and second(or more) file is being attached.

    Regards,

    Manas

  • Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    @Manas_Gautam - I have just tested with an incident with no attachments but in a status other than active. As soon as I added the attachment, the status changed to active. Is it possible your tests where with an incident that was already in active status?

  • Manas_GautamManas_Gautam Customer IT Monkey ✭
    edited October 2020

    @Justin_Workman Yes, I checked again. The incident on which I am testing this code is not in Active status. The same issue still persists. On first attachment status is not changing to Active. The ticket is in custom status input of waiting reply from end user.

  • Manas_GautamManas_Gautam Customer IT Monkey ✭

    @Justin_Workman Is there any modification in code or any other approach you can recommend?

    Regards,

    Manas

Sign In or Register to comment.