Hello.
The answer to my question has probably already been given elsewhere but I have not found anything so here it is: I don’t know anything about javascript (that’s important to say).
I want to create TF forms that would be connected to form fields of pdf files that I have previously created. The goal is to master from TF all my documents to send to my contacts (CRM).
Do you have a solution that is not too complex? Thank you for your help.
I think you’ve created a form script rather than a script field. Form scripts are created on the “Scripts” tab but “Field Scripts” are created like normal fields with the type “Script”. Script fields should monitor the state of the fields they reference and auto update when those fields change. Just copy the working form script and put it into a new script field.
Hi,
Thank you both very much for your help, it works
It is not automatic when I check the collection box, I have to trigger the script on each recording
(see in join)
Is there a possibility to make this automatic?
good week-end
Attachments:
You must be
logged in to view attached files.
Good catch on the form.saveAllChanges(), should have put that in my original script. Seemed to work ok without it in the small testing I did though.
No idea if there was an error in the script, I might have fixed something but it wasn’t mine to begin with and to be honest I don’t actually generally use this template.
I don’t know why there are gaps, I noticed that earlier but I wonder if that is because it’s not actually IMDB but an open version.
Well, it fixes your syntax error, doesn’t it? Sorry, I was only commenting on that and not checking your code!
You should add a form.saveAllChanges() at the end of the function to save the color changes.
Following script works for me:
function Script() {
var check_mark = record.getFieldValue('fld-906aa8b165cf42c0830fd79a460afe75');
if (check_mark) {
record.setRecordColor('#f00');
} else {
record.setRecordColor('#000');
}
form.saveAllChanges();
}
Script();
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
Hi,
Thanks for your help
I made the wrong field in my initial request
I want the line to change color when the check box in the Collection field is activated
I tried to understand and adapt your code with the corresponding field but I have a script execution error (see in join)
If you can help me
Good night
Attachments:
You must be
logged in to view attached files.
Test but error script at line 13
Attachments:
You must be
logged in to view attached files.
Hi,
Yeah !!! ? It works
Just to understand … Did you have an error in the script?
Another question :
Do you have an explanation for the fact that not all episodes are integrated?
For example, Band of Brothers (still ;-) but with others series too, there are missing episodes
See screenshots
Thank you very much for the correction
Attachments:
You must be
logged in to view attached files.
The Javascript API gives you the ability to iterate over all records in a form (form.getRecords()), you can use a search term (form.getRecordsForSearchTerm('term')) and you can also use a saved search (with the saved search selected, search.getRecords()).
If you know what your criteria is and you can programmatically validate them then you can use a form script to update the values. I think I’d aim to have a saved search because you can review the target records and then use search.getRecords() to set the value.
Something like this should work, you’d need to replace the field ID with your own:
search.getRecords().forEach(rec => rec.setFieldValue('fld-changeme', 1337))
If you put that into a form script (delete all of the boilerplate), update the ‘fld-changeme’ to match the field ID (if you double click on the left it should insert a place holder you can get it from) and then change 1337 to the number you want it to be then it should bulk fill the field for you. I’ve typed this a little off the cuff but it should work.
With a little bit more work you could probably set it up with a prompter to prompt for the value but that should work to begin with.
You can use a script field to watch another field and set the record colour. Using the TV Shows template, here’s a script to watch a checkbox and set the field to green if checked or white if not:
var completed = record.getFieldValue('fld-25c62d7db6004725910d926d8a7fd085');
if (completed)
{
record.setRecordColor('#00FF00');
}
else
{
record.setRecordColor('#FFF');
}
Replace the hex colours with your own preferred colours and you can use a similar situation to check if it’s a given number and set the appropriate colouur.
Try replacing the script with the contents of this gist: https://gist.github.com/pasamio/3086e8209676e956459f6325b38ab95d. It should output some debugging messages once you submit the input, e.g.:
11/6/20, 9:58:32 pm / TV Shows / Import from imdb
["/title/tt0185906/","tt0185906"]
Requesting: https://www.omdbapi.com/?i=tt0185906&apikey=???&type=series&r=json
series already exists Band of Brothers
getting season number 1
Requesting: https://www.omdbapi.com/?i=tt0185906&apikey=???&season=1
Getting episode 2
epsiode already exists: Day of Days
Getting episode 3
epsiode already exists: Carentan
Getting episode 5
epsiode already exists: Crossroads
Getting episode 6
epsiode already exists: Bastogne
Getting episode 7
epsiode already exists: The Breaking Point
Getting episode 8
epsiode already exists: The Last Patrol
Getting episode 9
epsiode already exists: Why We Fight
Getting episode 10
epsiode already exists: Points
If you open the script up in the script editor, the text box on the bottom right is the console log. Can you share the output of that corner with the input?
How are you determining which records to enter the same content in? Is it based on a value they have (or don’t have)? Is it just selecting them? Is it based on when they were created or last modified?
If you can figure out something in the record, you could script it. If you’re selecting a bunch of records, I’m not sure there is a way to change their values. If selecting records created a selection Javascript object, then you could script it but apart from that I’ll defer to Brendan.
Hi,
Is it possible to colorize the lines in multicolumn mode according to a check box?
A script?
I have a collection and I would like the row of a record to be colored if the check box is activated for each record
Or even better depending on a value 1 or 2 or 3 in a field, the color would be different
Unless there is another solution?
Attachments:
You must be
logged in to view attached files.