How to manually update Todo table

Dear experts,

we have some records in the Todo table (db->Todo), they are not up to date, e.g. an incident is resolved, but the corresponding record in Todo is still Work in Progress. How this could happen? More important, how can I update this Todo record?

Thanks for an advise,

Tianying

  • Hello,

    did it happen only for some exact records? Anything in common with the records for which it did not work?

    As I remember there were triggers which made that synchrionization.

    Regarding update - you can do it directly by inputing reuired values ,  though it is strongly not recomended.

  • Hi Vadim,

    customer provided a list of request records. The trigger must be "after.request.update.todo-> call application trigger.update.ToDoList" for request table with After Update type. You cannot start it manually. The record is e.g. closed, but in table Todo it's fulfilled. The Todo table is readonly even for admin user. I think it only will be updated in bg. So we need a way to sync the Todo table.  

  • Verified Answer

    Hi,

    tested successfully with SM9.52 but should work also in 9.41.

    var util_rad = system.library.ScAPI_RAD;
    
    /**
     * update the Todo table
     *
     * @author     Marcus Reinhardt, webstone@gmail.com
     * 
     * @license    MIT
     *
     *
     * @example    <caption>Request</caption>
     * system.library.hpe_todo_updater.updateTodo("probsummary");
     * 
     *
     * @param      {string}  cModule  The module
     */
    function updateTodo(cModule) {
    
        var fTodo   = new SCFile("Todo");
        var qTodo   = 'itemType="' cModule '"';
        var rcTodo  = fTodo.doSelect(qTodo);
        
        
        switch( cModule ) {
        
            case "incidents":
                var cUniqueKey  = "incident.id";
            break;
            
            default:
                var cUniqueKey  = "number";
        }
    
        while(rcTodo == RC_SUCCESS) {
        
            var fRecord = new SCFile(fTodo['itemType']);
            var qRecord = cUniqueKey '="' fTodo['record.id'] '"';
            var rcRecord = fNewRecord.doSelect(qNewRecord);
        
            var params = [
                util_rad.input_File( 'file', fRecord ),
                util_rad.input_File( 'record', fRecord ),
                util_rad.input_Number( 'name', 4 )
            ];
            
            var results = util_rad.invokeRAD( 'add.update.todo.records', params );
                
            rcTodo = fTodo.getNext();
        }
    }

    Now you can create a new display option, which calls the following script:

    system.library.hpe_todo_updater.updateTodo("probsummary");

    Testing:

    1. deactivate the triggers via the RAD Debugger

    x $L.void=rtecall("trigger",,0)

    2. Update a Incident record (e.g. change the status)
    3. Go to the Todo and click "refresh" => Status should be the old one
    4. Execute the JS Script or click your new created button
    5. Refresh the Todo => Status should be updated

     

    Hope that helps.