Need help building a formula that edits records when clicked.

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I have three tables.. SKU Table, Samples Table and Order Request Table.    SKU < Samples.   Order Request < Samples.

A Sample record states the specific use (taken from the Order Request) for a SKU. eg...

Sample1: SKU0001, [Qty] = 1 used for Product photography

Sample2: SKU0001, [Qty] = 1 used for Lifestyle1 photography


Each Sample has a calculated [Sample Status] that indicates whether it is 'Open' or 'Closed'. 

If multiple 'Open' samples share the same SKU and have equal [Qty] we only want to physically order one unit of that SKU and reuse it for each Order Request. 


The SKU record has attributes [Primary Sample], [Secondary Sample], [Tertiary Sample], ect.

The 'Open' Sample with the lowest Record ID tied to a SKU is the Primary Sample, then the next 'Open' Sample with next lowest Record ID tied to that SKU is the Secondary Sample and so on.. Tertiary Sample, ect. 


Samples have attributes [Inbound Tracking], [Location], [Outbound Tracking]

If multiple 'Open' samples share the same SKU and have equal [Qty], but do not have matching values on the above attributes we want to create a button on the sample record that users can click to runs a script that identifies the Primary Sample, copies the values of these attributes and replaces the values on the Secondary Sample, Tertiary Sample, ect. with the values of the Primary Sample. 

Trying to figure out how to write a script so this can be run on both the Primary Samples and the Secondary Sample, ect. so users do not have to navigate to the Primary Sample each time they want to sync values. 

Photo of Nicholas

Nicholas

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,984 Points 20k badge 2x thumb
tl;dr = https://en.wikipedia.org/wiki/TL;DR

You should implement all of your functionality in JavaScript using $..getScript(). The formula language is very difficult to debug yet alone read when you cram multiple formula calculations and JavaScript fragments into one formula.