User Tools

Site Tools


replicator_snc_subscribe

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
replicator_snc_subscribe [2015/10/12 14:29]
paul
replicator_snc_subscribe [2018/08/01 16:28] (current)
angela.zhang
Line 29: Line 29:
 **Subscribed** : The number of records that have been subscribed to as of this time.  This field can be ignored. **Subscribed** : The number of records that have been subscribed to as of this time.  This field can be ignored.
  
-**Run business rules** : A checkbox to indicate if this table should run business rules on data it receives while subscribing.  See [[Replicator_SNC_Business_Rules|Business Rules]] for more information.+**Run business rules** : A checkbox to indicate if this table should run business rules on data it receives while subscribing.
  
-=== Override system ​fields ​===  +**Copy empty fields** : A checkbox to indicate if fields that are empty/​null ​should be copied over or instead disregarded As of UpdateSet ​<wrap info>version 3.12.0</wrap> this will be selected by default ​and will also only overwrite fields which are contained ​in the incoming record.
-A checkbox to indicate if data subscribed to should maintain the system field values from the sharing instance. ​ This includes ​fields ​like "​Created By" such that entries show the same "​Created By" value as in the sharing instance versus showing a generic system account as defined in your SNC configuration. ​ This box should ​generally ​be checked. +
-<WRAP round info> +
-If you have checkmarked to "​Include journal fields"​ and/or "​Include attachments"​ on the [[Replicator_SNC_Share|share]] configuration related to this subscribe, you will also need to checkmark this option on the subscribe configurations for the sys_journal_field,​ sys_attachment and sys_attachment_doc in order for their content to be created by the same user. +
-</WRAP> +
- +
-=== Refresh history set === +
-A checkbox to indicate if the history set for this table should ​be refreshed ​and updated when content is updated in other tables that are tied to this table. ​ This is needed if the sharing instance is sharing journal field entries and attachments and this instance is subscribing to them so that new journal field entries/​attachments tied to this table will refresh for this table'​s entries to see them in their history set.  In general this setting should be checked //​with ​the exception of the sys_audit log// (which has a large number of entries tying everything together already so it doesn'​t need to be refreshed). +
- +
-**Copy empty fields** : A checkbox to indicate if fields that are empty should be copied over or instead disregarded.+
  
 **Active** : A checkbox to indicate if this table is actively subscribing. **Active** : A checkbox to indicate if this table is actively subscribing.
Line 52: Line 43:
 **Source table name** : A field to enter the source table name if it is different on the sharing instance. ​ If the table names are the same, this field can be left blank. **Source table name** : A field to enter the source table name if it is different on the sharing instance. ​ If the table names are the same, this field can be left blank.
  
-=== Field prefix === +If you specify ​source table name and the source ​table shares attachments to this subscriber, you will want to add [[before_subscribe_script|Before Subscribe Script]] in the sys_attachment subscribe configuration ​in order to properly link attachments to incoming records.
-A field indicating if fields in the sharing instance have prefix that the table on this subscribing instance does not.  For example the sharing table may have fields with prefix of "​u_"​ whereas ​the subscribing table may not.  This field can be left blank if the field names are the same which will apply in most cases.+
  
-**Condition** : To specify a set of conditions in order to subscribe to data for this table.  ​For example, if you want to subscribe ​to only data related to one customer ​you would specify ​a condition here. +For example, if you have an incident table subscribe ​configuration where you specify ​the source ​table name as "u_custom_incident"in the sys_attachment subscribe configuration'​s ​Before ​Subscribe Script, you would add the following script: 
-   +<​code>​ 
-=== Condition script === +if(current.table_name ​== '​u_custom_incident'​) 
-Similar to Condition allowing you to specify conditions in order to subscribe to data for this table.  The script will be evaluated and return a value "anded" ​with those specified ​in the "​Condition"​. ​ The "​current"​ global variable represents the incoming record de-serialized into GlideRecord. +{  
- +    current.table_name = '​incident'​ 
-=== Before ​subscribe script === +}
-This script will execute right before an insert or update allowing a chance to modify the record before persisting. "​current"​ is the record being written while "​qcurrent"​ represents the inbound queue record. ​ To access the GlideRecord object for the incoming record, use the "​repl_gr"​ variable <wrap info>​version 3.1.11</​wrap>​. This is useful for when you want fields in the subscribing table to be populated with data from shared records that are not exactly the same. For example if you want the short_description field in the subscribing table to be populated with the key from a shared record, you would add the following script: +
- +
-<​code ​javascript+
-current.short_description ​qcurrent.key;+
 </​code>​ </​code>​
  
-For example, to set the //short_description//​ field to the incoming record'​s //number// field, you would do this:+//4. When setting up the tablemake sure you mark at least one of the optionsCreate, Update, Delete.//\\
  
-<code javascript+===== Override system fields =====  
-current.short_description = repl_gr.number; +A checkbox to indicate if data subscribed to should maintain the system field values from the sharing instance. ​ This includes fields like "​Created By" such that entries show the same "​Created By" value as in the sharing instance versus showing a generic system account as defined in your SNC configuration. ​ This box should generally be checked. 
-</code>+<WRAP round info
 +If you have checkmarked to "​Include journal fields"​ and/or "​Include attachments"​ on the [[Replicator_SNC_Share|share]] configuration related to this subscribe, you will also need to checkmark this option on the subscribe configurations for the sys_journal_field,​ sys_attachment and sys_attachment_doc in order for their content to be created by the same user
 +</WRAP>
  
-You can use dot-walking ​to display values from a referenced ​field. ​+===== Refresh history set ===== 
 +A checkbox ​to indicate if the history set for this table should be refreshed and updated when content is updated in other related tables. ​ For example, if you are subscribing to the incident table and you want to refresh the incident record'​s history set in order to see the record'​s journal ​field entries and attachments 
  
-For exampleif you were subscribing ​to a ticket recordin the //before subscribe script// text box, you can reference a field by using the folliwing script:+<WRAP round info> 
 +This option **should not** be selected on subscribe configurations for the **sys_auditsys_journal_field,​ sys_attachment and sys_attachment_doc tables**. ​ These tables themselves do not have history sets to refresh. ​ If you want to refresh to see these journal/​audit/​attachment records on table such as incidentselect this option on the incident table instead. 
 +</WRAP>
  
-  current.name repl_gr.assigned_to.name+In <wrap info> [[updateset_releases|v3.20.0]] </​wrap>,​ a scheduled job will run every minute to refresh history set for subscribed records. ​ Previously, a Run Once scheduled job was created for each record that was to be refreshed. 
 +===== Field prefix ===== 
 +A field indicating if fields in the sharing instance have a prefix that the table on this subscribing instance does not.  For example the sharing table may have fields with a prefix of "​u_"​ whereas the subscribing table may not This field can be left blank if the field names are the same which will apply in most cases.
  
-This will display ​the //​display_value//​ versus just the //sys_id//.+**Condition** : To specify a set of conditions in order to subscribe to data for this table. ​ For example, if you want to subscribe to only data related to one customer you would specify a condition here. 
 +   
 +===== Condition script ===== 
 +Similar to Condition allowing you to specify conditions in order to subscribe to data for this table. ​ The script ​will be evaluated and return a value "​anded"​ with those specified in the "​Condition"​. ​ The "​current"​ global variable represents ​the incoming record de-serialized into GlideRecord.
  
-<wrap info>version 3.2.8</​wrap>​\\ +In <wrap info> ​[[updateset_releases|v3.16.0]] </​wrap>​, users can access ​the inbound message ​in the condition script represented by //​qcurrent//​For example the following script ​is set up to only accept messages from specific instance, accessed by //​qcurrent//​.key.
-For the case where you are updating a record that already exists ​in the system, "​gr_before"​ is a GlideRecord object for this record before doing the update ​This ​is useful for when you want to compare ​record'​s values as they currently exist in the system with the values in the incoming record and do any processing as a result.+
  
-For example, to fire the incident table'​s event when the assignment group is changed (the "​incident.assigned.to.group"​ event as specified in the incident table'​s "​incident events"​ business rule), you would do the following: 
 <​code>​ <​code>​
-if (gr_before.assignment_group !repl_gr.assignment_group) { +qcurrent.key == "instance"
-  gs.eventQueue("incident.assigned.to.group", current, current.assignment_group,​ previous.assignment_group.getDisplayValue());​ +
-}+
 </​code>​ </​code>​
 +===== Before Subscribe Script =====
  
 +{{page> before_subscribe_script&​noheader&​nofooter}}
 +
 +===== After Subscribe Script =====
 +
 +{{page> after_subscribe_script&​noheader&​nofooter}}
 +
 +
 +//4. Once done, click "​Submit"​ (new table configuration) or "​Update"​ (current configuration) to save your changes.//  ​
  
 <WRAP round tip> <WRAP round tip>
Line 99: Line 100:
 Note if any fields do not appear on your form, right-click on the "​Replicator Configuration"​ title and choose Personalize > Form Layout and then add the missing fields to the form. Note if any fields do not appear on your form, right-click on the "​Replicator Configuration"​ title and choose Personalize > Form Layout and then add the missing fields to the form.
 </​WRAP>​ </​WRAP>​
- 
-//4. Once done, click "​Submit"​ (new table configuration) or "​Update"​ (current configuration) to save your changes.//  ​ 
- 
  
replicator_snc_subscribe.1444685370.txt.gz · Last modified: 2015/10/12 14:29 by paul