Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
protogrid:agents [2021-12-13 18:14] – [Execution] dru | protogrid:agents [2023-01-16 23:16] (current) – [Example] dru | ||
---|---|---|---|
Line 9: | Line 9: | ||
==== Example ==== | ==== Example ==== | ||
- Create a Proto with a DateTime Field and a Text Field. Copy the key of the Text Field. | - Create a Proto with a DateTime Field and a Text Field. Copy the key of the Text Field. | ||
- | - Create a user profile with rights to edit the proto created above. | + | - Create a user profile with rights to edit the proto created above but without Environment Administrator rights. |
- | - Create an Agent Library, specify the user created above as context user and copy the following code. Replace the value of //defkey_status_field// with the key from above. | + | - Create an Agent Library, specify the user created above as context user and copy the following code. Replace the value of //fieldkey_status_field// with the key from above. |
+ | - Create a Proto for parameter values with a Text Field, copy the key of the Text Field and replace // | ||
- Add this Agent Library to your Proto. | - Add this Agent Library to your Proto. | ||
- Based on this proto, create some cards where the date lies within the next 60 minutes. Wait one hour. | - Based on this proto, create some cards where the date lies within the next 60 minutes. Wait one hour. | ||
Line 17: | Line 18: | ||
<code javascript> | <code javascript> | ||
function agent_library() { | function agent_library() { | ||
- | var defkey_status_field | + | var fieldkey_status_field |
var cardkey_parameter_deadline_reached = ' | var cardkey_parameter_deadline_reached = ' | ||
- | var defkey_message_deadline_reached | + | var fieldkey_parameter_value |
// Make sure that this function does not return until all operations and JSON-API requests are completed / fulfilled. | // Make sure that this function does not return until all operations and JSON-API requests are completed / fulfilled. | ||
Line 33: | Line 34: | ||
// Here is an example for an authenticated axios GET request: | // Here is an example for an authenticated axios GET request: | ||
try { | try { | ||
- | var data = await axios.get(baseurl + ' | + | var response |
' | ' | ||
' | ' | ||
Line 40: | Line 41: | ||
console.log(' | console.log(' | ||
- | var loaded_card = monkey_patch_card(data.result); | + | var loaded_card = monkey_patch_card(response.data.result); |
- | var loaded_message = loaded_card.get_value(defkey_message_deadline_reached, 'Frist abgelaufen' | + | var loaded_message = loaded_card.get_value(fieldkey_parameter_value, 'Frist abgelaufen' |
- | card.set_element_value(defkey_status_field, loaded_message); | + | card.set_element_value(fieldkey_status_field, loaded_message); |
return true; | return true; |