Is it possible to change the Dashboard owner name using Scheduled Job?

Community Alums
Not applicable

Hi Experts, 

I need to change the Dashboard owner name using scheduled job. not by manually or by some other method
Kindly help me on how can I achieve this.


Thanks in advance
Chaithra


6 REPLIES 6

Jaspal Singh
Mega Patron
Mega Patron

You can navigate to Dashboard (pa_dashboards) table & update it from List View.

If you still need a job or so yes it is possible you need to GlideRecord Dashboard (pa_dashboards) table & update owner accordingly.

Community Alums
Not applicable

Hi @Jaspal Singh 

Thanks for the reply. 


I have tried the below code in Fix script it is working there. But when I tried to implement it in scheduled job It is not working. 

var gr = new GlideRecord('pa_dashboards');
///gr.addEncodedQuery('name=test');
gr.addEncodedQuery('sys_id=03af95f81b9d67XXXXX943d9c979f1d4bcbfa');//sys_id ofdashboard
gr.query();
while(gr.next()){
gr.owner = 'XXXXX';// user_name
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.update();
}

 

Thanks,
Chaithra

Should work. Can you try executing the code in Schduled job using 'Execute now' button. 

Additionally, what is Run As set for the scheduled job.

Community Alums
Not applicable

Hi @Jaspal Singh 

Yes executed but getting error in job logs as "Dashboard not executed, advanced condition not met".

Could you please look into it.
find_real_file.png
Thanks,
Chaithra