Home General Discussion

Cireson - Portal

CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

Dear All,

I would like to block "Change Status" under tasks for a selected technician account only.

Does anyone have code which can do this?

Kind Regards

Daniel

Best Answers

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭
    Answer ✓

    I tried using the above code against a username in AD and it doesnt work too.

    //Inside Incident form:
    app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
    	//bind a function to the form ready event
    	formObj.boundReady(function () {
    		console.log('HideTask script is run...');
    		console.log('Your user id is: ' + session.user.Id);
    		//Hide task if user id match
    		if(session.user.Id == **** Username ***) //<<----- CHANGE TO MATCH THE USER ID
    		{
    			$('li[data-bind="click: changeStatus"]').hide();
    		}
    	});
    	return;
    });
    


Answers

  • Mikkel_MadsenMikkel_Madsen Customer Advanced IT Monkey ✭✭✭

    If it's just the task when you are in an incident you can do this:

    //Inside Incident form:
    app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
    	//bind a function to the form ready event
    	formObj.boundReady(function () {
    		console.log('HideTask script is run...');
    		console.log('Your user id is: ' + session.user.Id);
    		//Hide task if user id match
    		if(session.user.Id == 'c148934e-3993-5647-6334-4407a91448xx') //<<----- CHANGE TO MATCH THE USER ID
    		{
    			$('li[data-bind="click: changeStatus"]').hide();
    		}
    	});
    	return;
    });
    

    But you have other ways to change status. You can do it in the "send email" task or from tasks in grid view

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    Thanks for this but how do i find out a session user id code?

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭
    Answer ✓

    I tried using the above code against a username in AD and it doesnt work too.

    //Inside Incident form:
    app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
    	//bind a function to the form ready event
    	formObj.boundReady(function () {
    		console.log('HideTask script is run...');
    		console.log('Your user id is: ' + session.user.Id);
    		//Hide task if user id match
    		if(session.user.Id == **** Username ***) //<<----- CHANGE TO MATCH THE USER ID
    		{
    			$('li[data-bind="click: changeStatus"]').hide();
    		}
    	});
    	return;
    });
    


  • Mikkel_MadsenMikkel_Madsen Customer Advanced IT Monkey ✭✭✭

    You can get an userid by email

    http://PORTAL/api/V3/User/GetUserRelatedInfoBySIPAddress?sipAddress=YOUR@EMAIL.COM
    

    Change PORTAL to your portal address

    Change the YOUR@EMAIL.COM to the email of the user

    Look for BaseId in the first line of the result you are getting back

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    How can I do this if the user is just an AD user and doesn't have an email? I tried and it doesn't work?

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    Thanks for this help so far by the way:

    This is the error:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/"/>

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    I have managed to get this by adding an address into the mail attribute.

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    How do i use this code to hide assign to analyst by group?

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    I have managed to hide the assign analyst by group now.

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    Thank you for the help Mikkel, really appreciate it.

    Kind Regards

    Daniel

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    Dear Mikkel,

    I need to hide "Reactivate Incident" for a user too. Can you let me know how to do this?

    Thanks

    Dan

  • Mikkel_MadsenMikkel_Madsen Customer Advanced IT Monkey ✭✭✭

    By F12 you can find the different tasks


    $('li[data-bind="click: setNewStatus"]').hide();
    


Sign In or Register to comment.