Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Archer Custom Object to open a cross reference record

SharathBabu
Contributor III

Hello Everyone,

 

I have included the below custom code to open a particular record of a cross reference field based on the user logon name, however while closing the record (child record) I'm receiving the error (see the attached doc) - parent page loaded without css

 

Could you all look into this and advise? Appreciate your help in advance.

 


function getMatchingElements(){
var loggedInUser = parent.ArcherApp.globals.displayName;
var table = $('table[id *="21713srvgrid"] tbody');
   var count = 1;
   var str = '';
var matchingRows =[];

   table.find('tr').each(function (i) {
   
       var $tds = $(this).find('td'),
           trackingId= $tds.eq(0).find('a').text(),
           country = $tds.eq(1).find('span').text(),
     businessArea =$tds.eq(2).find('span').text() ,
     controlGroup =  $tds.eq(3).find('span').text(),
           signatory = $tds.eq(5).find('a').text();
           if(signatory === loggedInUser){
      str += count + "."+trackingId + "--";
    str += country + "--";
    str += businessArea + "--";
    str += controlGroup + "\n";
    count++;
            matchingRows.push(i);
           }
   });

 

   if(matchingRows.length > 1){
    var response = prompt('You have '+ matchingRows.length + ' matching records waiting for approval. Please select one. '+ str + "Enter your selection.");
    if(response){

    var tr = table.find('tr')[matchingRows[(parseInt(response) -1)]];
 debugger;
    tr.children[0].children[0].click();
    }
   }
   else if(matchingRows.length === 1){
  var selectedRow =  table.find('tr')[matchingRows[0]];
  debugger;
  var anchorElementTd = selectedRow.children[0].children[0];
  
  var href = anchorElementTd.href;

//window.location(href);
  var value = href.split("('")[1].split("|'")[0];
  $pbC(value);
}
}

3 REPLIES 3

jaskiratsingh
Contributor III

Hello Babu, 

Could you please attach the screenshot with proper styling . it would be easy to understand your requirement.

And you can open the link (#href ) in a new tab then no worry to close it ? will that work?

Thank you Jaskirat for your advise. Business requirement is to open in the same window. And the href is calling a JavaScript module and not a url.

 

Also attached the actual screen of how it looks

SharathBabu
Contributor III

David Petty‌ - could you please help me with the above?