AnsweredAssumed Answered

Portal updates sometimes

Question asked by nihmbrisby on May 26, 2014
Latest reply on May 28, 2014 by philmodjunk

Title

Portal updates sometimes

Post

     Hello,

     I have a script that is fired from a table occurrence based on Invoices.  It creates a new invoice line item in a table joining invoices with contacts.  

     It seems to work fine.  In my layout based on the aforementioned table occurrence (itself based on Invoices), I have a portal looking into the join table.  After the script runs the new record is only sometimes (i'd say around 50%) displayed in the portal.  If it isn't, than clicking on the portal will cause it to update.  My script-

      

Allow User Abort [ Off ]
If [ Get ( ScriptParameter ) = "Transactions | Contact Popover | Affect Contact" ]
Exit Script [ ] //This exits the script if/when it's triggered within itself
End If
Set Field [ Transactions::__Nonglobalsearch; "" ] //This clears my search field (which filters the portal of all contacts and which I no longer use a global for (hence the name)
Commit Records/Requests [ No dialog ]
If [ not IsEmpty ( Get ( ScriptParameter ) ) or not IsEmpty ( Transactions::_fkContactsIDGlobal) ] //The script parameter is for if they clicked on the portal to select a contact.  Transactions::fkContactsIDGlobal is if they create a new contact.  It's used in a relationship between Invoices and Contacts which allows for creation of records in Contacts
Freeze Window

//These next steps take the primary keys (INVoices and COntacts) to a new record in the join table

Set Variable [ $CONTACTS_ID_TRANSACTIONS; Value:If ( not IsEmpty ( Get ( ScriptParameter ) ) ; Get ( ScriptParameter ) ; Transactions::_fkContactsIDGlobal) ]
Set Variable [ $TRANSACTION_ID_CONTACTS; Value:Transactions::__pkTransactionsID ]
Go to Layout [ “Utility_Contacts_Transactions” (join_Contacts_Transactions) ]
New Record/Request
Set Field [ join_Contacts_Transactions::_fkContactsID; $CONTACTS_ID_TRANSACTIONS ]
Set Field [ join_Contacts_Transactions::_fkTransactionsID; $TRANSACTION_ID_CONTACTS ]
Go to Layout [ original layout ]
Else
Go to Object [ Object Name: "Select Contact Panel" ]//This branch happens if they select 'new contact' but don't enter anything
End If
Set Field [ Transactions::_fkContactsIDGlobal; "" ]
Commit Records/Requests [ No dialog ]

      

     PS If the user has created a new contact, the portal always refreshes.  It's only when the script fires from the button that's overlaying the portal from which the user can pick a contact.

Outcomes