My method suddenly stopped working...

//state_provience fields

if(globals.searchField20)
{
//state_provience
if(contact_to_address)
{
contact_to_address.state_provience = globals.searchField20 + ‘%’
}
needNewRec = true
}

if(globals.searchField21)
{

if(needNewRec)
{
controller.duplicateRecord(true)
}

//state_provience2
if(contact_to_address)
{
contact_to_address.state_provience = globals.searchField21 + ‘%’
}
needNewRec = true
}

Why would the first instance of contact_to_address work and the second not work? This suddenly just started happening and it was working fine.

Here’s the error I get:

“contact_to_address” is not defined.
Callstack:
dlg_find_detailed.updateFind

Can’t tell you why it ‘suddenly’ stopped but you sure need to change this:

f(contact_to_address)
{ 
contact_to_address.state_provience...

into this:

f(databaseManager.hasRecords(contact_to_address))
{ 
contact_to_address.state_provience...

Hope this solves the issue…

Marcel:

I did change that and it had the same effect. (I wanted to put up the original code, but I should have put up both).

It’s weird, it works on the first instance of the relation, but not on subsequent.

Hi Providence,

Could it be that, after the duplication, the method cannot resolve the relationship ?

Perhaps you need a ‘savedata()’ in there following the duplicate command

Cheers
Harry

Harry,

That was a good call. I tried it but it still seems to lose it’s relation.

Any other ideas?

John

Hi John,

Nothing instantly springs to mind other than :

  1. Is that the whole method that you posted or a snip - could be that some other steps inside are the real culprit(s) ?
  2. Can we get a demo solution which exhibits this problem so that we could run a test here ?

Other than that, I tend to agree with Marcel regarding the boolean test on the relationship itself as this just seems to test for the validity of the relationship and not the related records/data !
Also what platform/version are you on and have you upgraded or otherwise changed the configuration recently ?

Cheers
Harry