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

cancel
Showing results for 
Search instead for 
Did you mean: 

Sub-Forms and Last Updated

TimothyScott1
Contributor III

I have noticed that saving new record entries to my sub-form does NOT update the 'Last Updated' field of my parent record.

How can I determine if a new sub-form entry has been made for the purposes of sending a notification?

I have tried using the Criteria 'Action Log' and operator 'Changed' but this seems to never evaluate to TRUE.

 

It seems the parent record is unaware of changes to the sub-form.

 

thank you!

26 REPLIES 26

Lee, make sure you add the type attribute "text/javascript" to the opening script element; <script type="text/javascript">

 

You can either add alert(), or console.log() (must have the browser developer tools open and the console tab selected) at various points of the custom object to see where it's failing.  You can either pass text, variables or combination of both in either functions.

 Advisory Consultant

David,

I had console.log statements galore but there is never a failure. The JSON request and the URL are created and formatted correctly. I even took out all the case statements, hard coded the field IDs and URL, ran it successfully in Dev, then ONLY changed the field IDs and URL for Test and it doesn't work. Is there something on the back end that needs to be done to get this functionality to work, that maybe we've done in Dev but not in Test? 

I see some hard coded values:

  var recentComment = $('div[id*="f12789c"]').text().trim();
       var recentAuthorALL = JSON.parse($('input[id*="f12788c"]').val())

 

Any of these are different in TEST?

Those are the field IDs for the subform and yes, they are different in Test, but I have them separated via the case statements.  I confirmed via developer tools that those variables are being set properly.

Well, I can only think if your API setup is different in TEST. E.g. shielded by SSO, set as not anonymous authentication for API and PlatformAPI web nodes.

There's nothing on the back end that needs to be done.

 

Also the function grabData() should sit outside of Sys.Application.add_load(function() { });.

 

What you can try doing is add debugger right after $('#master_btnSave').click(function(event){ and via the debugger in the developer tools you can step through the code line-by-line to see what's going on.

 

Lastly, if your on a newer version of Archer hijacking the Save and Save and Close buttons has to be done differently.

// Hijack Save and Close Button
$('#master_btnSave').clone().attr('id', 'master_customBtnSave').insertBefore('#master_btnApply');
$('#master_btnSave').hide();
$('#master_customBtnSave').unbind('click').prop("onclick", null).click(function(){ CheckUsers('save');return false;});

// Hijack Save Button
$('#master_btnApply').clone().attr('id', 'master_customBtnApply').insertBefore('#master_btnApply');
$('#master_btnApply').hide();
$('#master_customBtnApply').unbind('click').prop("onclick", null).click(function(){ CheckUsers('apply');return false;});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Then call either $('#master_btnSave').click(); or $('#master_btnApply').click();

 Advisory Consultant

Kevin_Corbett
Collaborator III

Here's another out-of-box (no data feed) solution using the Schedule/Bulk Action feature available in later releases of v6.

This solution can send subscription notifications as frequently as 1 hr when new/modified sub-form records are added.

 

Create three fields on the sub-form parent application:

  1. Most Recent Sub-Form Last Updated
    • Date/Time
    • Calculated
    • MOSTRECENTVALUE(REF([Sub-Form Name],[Last Updated]),REF([Sub-Form Name],[Last Updated]))
  2. Most Recent Scheduled Action Updated
    • Date/Time
    • Private field - everyone (read only, Bulk Action will populate)
  3. Trigger Schedule/Bulk Action
    • Values list
    • Yes/No
    • Calculated
    • IF(
      ISEMPTY([Most Recent Sub-Form Last Updated]),

      VALUEOF([Trigger Schedule/Bulk Action],"No"),

       

      IF(
      AND(
      NOT(ISEMPTY([Most Recent Sub-Form Last Updated])),
      ISEMPTY([Most Recent Scheduled Action Updated])
      ),
      VALUEOF([Trigger Schedule/Bulk Action],"Yes"),

      IF(
      [Most Recent Sub-Form Last Updated] > [Most Recent Scheduled Action Updated],
      VALUEOF([Trigger Schedule/Bulk Action],"Yes"),

      VALUEOF([Trigger Schedule/Bulk Action],"No"))))

 

How these fields work together:

The 'Trigger Schedule/Bulk Action' fields compares the most recently updated Sub-form record (Most Recent Sub-Form Last Updated) to a field that is updated by a Schedule/Bulk Action (Most Recent Scheduled Action Updated).

When a new/updated sub-form record is created, the Most Recent Sub-Form Last Updated will be greater than
Most Recent Scheduled Action Updated field.

  • This will cause the Trigger Schedule/Bulk Action values list field to change to 'Yes'
  • When the Schedule/Bulk action runs (next step), the opposite will be true and the Trigger Schedule/Bulk Action will change back to 'No'

 

Next, you need to create a Schedule/Bulk Action associated to the Sub-form parent application.

  • The filter criteria for the Schedule is Trigger Schedule/Bulk Action = Yes
  • The Bulk Action is to populate Most Recent Scheduled Action Updated with the current date/time
  • Schedule frequency - hourly, or whatever meets your requirements

 

Lastly, you need to configure a Subscription Notification for your new/modified Sub-form records.

  • Frequency should be set to instantly
  • Filter set to Most Recent Scheduled Action Updated 'Changed'