Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 4 of 4

Thread: Locked Record Update in Javascript

  1. #1
    Junior Member dey's Avatar
    Join Date
    Mar 2007
    Posts
    4

    Default Locked Record Update in Javascript

    We have a javascript that executes a "doSave" against locked records. When this script runs the user that has the record locked receives the "Record has changed since you selected it" message and looses all of their changes. Is there anyway to check if a record is locked within a javascript?

    Thanks

  2. #2
    Administrator tommy's Avatar
    Join Date
    Nov 2001
    Location
    Copenhagen
    Posts
    4,272

    Default

    Use doAction("save") instead. This checks for locks and you can check the return code and act according to it.
    Best regards Tommy
    Blog - - ITIL certified - Accredited Integration Specialist – HP OpenView Service Management

    Want to keep this site alive? Consider making a donation. Click here.

  3. #3
    Junior Member dey's Avatar
    Join Date
    Mar 2007
    Posts
    4

    Default

    Well I tried this and I don't get the error that the record has changed since I selected it. The problem is we are using an ioaction and wanted to make some changes and were thinking that the ioaction would be re-scheduled if the record was locked.

    Here is the code in question it an ioaction record:

    var probsummary =newSCFile("probsummary");
    var probsumquery ="number=\""+ vars.$L_file.number +"\"";
    var impact =newSCFile("jpsysimpactedlob");
    var impactquery ="number=\""+ vars.$L_file.number +"\" and assoc.table=\"probsummary\" and impacted=true";
    if ( probsummary.doSelect( probsumquery ) == RC_SUCCESS )
    {
    var implobarray =newArray();
    var impbuarray =newArray();
    if ( impact.doSelect( impactquery ) == RC_SUCCESS )
    {
    var i=0;
    do{
    implobarray[i]=impact.lob_name;
    impbuarray[i]=impact.impacted_bu;
    i++;
    }
    while (impact.getNext() == RC_SUCCESS);
    }
    probsummary.jp_impacted_lobs = implobarray;
    probsummary.jp_impacted_bus = impbuarray;
    var updateresult =probsummary.doAction("save");
    if ( updateresult != RC_SUCCESS)
    {
    if ( updateresult == RC_CANT_HAVE || updateresult ==51 )
    {
    var returnCode =system.library.interoperabilityHelpers.rescheduleA ction( probsummary,"jp.IM.updateImpacts");
    }
    }
    else
    {
    var rootcause =newSCFile("rootcause");
    var rcquery ="jp.parent.incident=\""+ vars.$L_file.number +"\"";
    if ( rootcause.doSelect( rcquery ) == RC_SUCCESS )
    {
    rootcause.jp_impacted_lobs = implobarray;
    rootcause.jp_impacted_bus = impbuarray;
    var rcupdateresult =rootcause.doSave();
    if ( rcupdateresult != RC_SUCCESS)
    {
    if ( rcupdateresult == RC_CANT_HAVE || rcupdateresult ==51 )
    {
    var returnCode =system.library.interoperabilityHelpers.rescheduleA ction( probsummary,"jp.IM.updateImpacts");
    }
    }
    }
    }
    }



  4. #4
    Senior Member tuncay's Avatar
    Join Date
    Jul 2004
    Location
    Germany
    Posts
    113

    Question similar problem with locks

    we have similar problems with locking is there a possibility to debug locking bugs?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts