app script OnEdit function not working when document is copied - google-sheets

I built a google sheets automation with AppScript.
The main function is an onEdit function.
I need other people to 'make a copy' of the entire document to run on their computers.
When someone makes a copy of the document, they are not triggered to approve the appScript code and the onEdit function (and other functions) do not respond.
I have to go into the appScrip editor on their computers and manually run one of the functions to trigger the approval dialog. Even then, the onEdit function doesn't seem to work.
Here is the document for your trial:
https://docs.google.com/spreadsheets/d/12ZE1QzyQ45GB6BtEIetKU4uHVG6rZrs2LVlvT36PnQE/edit?usp=sharing
Please make a copy of the document and add the following data in this order.
Cell A4: TEST
Cell B4: 0
Cell C4: Snack
Cell D4: 0
The onEdit function should be triggered and move the data to the table below.
Is there a way to streamline the appScript approval process?
Thanks!

this is not how scripts work. every (most of them) script is by default considered by google as "malicious" and requires users to authorize the script so if something bad happens the user is to be blamed for running the malicious code knowing the risk and not google. in other words, if you create a script it will be attached to the spreadsheet so whoever creates a copy he will copy the script too but then that user needs to go to the script editor and authorize the code for a given account. if you mean no harm with your script and want to share it, google's logic is to pack that script into an addon and publish it. after it will be verified by them as safe, this addon will be available on their platform ready to be installed by other users without those scary WARNING windowses.

Related

Log build file size using Jenkins and display results

This is a broad question, so any answers are deeply appreciated. I need to continually log the size of several build files (in this case some CSS and JS files), preserve this log and ideally show it as a dashboard in Jenkins.
I know that I can setup a cron job and execute a bash script to grab the files and log their size, but I'm not sure where this file would live and how to display it. Ideally the result would be a dashboard plot or bar graph over time.
Thanks.
P.S. I'm open to other logging suggestions, but Jenkins seems like the appropriate system to do this in.
Update: this isn't perfect but it works. Google Spreadsheets has a simple API for posting data, so this can work as an endpoint for any script you want to write that logs your data.
It's not a Jenkins solution, but gets the job done.
In my search leading up to this, I did come across JMeter, and the Performance Plugin for Jenkins, which were contenders for a possible solution.

Is there a way to automatically import issues from Jira into Taiga?

Just started using Taiga.io, and was wondering if there was a way to auto-import issues/stories so I don't have to manually rewrite them.
You could make some sort of sync program/script that pulls from a JIRA project into a Tangia project.
Example. Have a file that contains the latest JIRA issue key that exists within Taiga and then the script runs every hour. Upon execution it does a REST call to get any issues above that JIRA key (Ex. TEST-5):
/rest/api/2/search?jql=key%20>%20TEST-5%20order%20by%20key%20desc
Then it updates the file with the highest key value and then pushes each issue into Taiga which can be done using the Taiga REST API.
Additionally you may be able to do something with the JIRA Workflow so that when issues are created something occurs within the workflow that calls the Taiga REST API and creates the task automatically.
Just save them in a format recognized by both Jira and Taiga than each time the file changes you just import it to Taiga (I used csv Excel and it worked pretty fine). The only downside is that you need to stay loggedin 24/7 if you work with worldwide distributed teams in order for the auto-function to work...

Auto assign to team lead/developer on bug reopen

In my implementation of JIRA, I have a custom field called Developer which gets populated automatically (username) whenever someone move the JIRA from Open to Fixed state. Now I want something similar for the Fixed to Reopen transition. That is, whenever the tester changes the status to Reopen, it should go back to the Developer or the Project Lead (in case the field isnt populated as the custom field can be overridden).
I tried to implement a post function, but there isn't a way where I can use OR criteria. Or is there a way?
You can do a Post Function on the transition using the Script Runner plugin if its a self-hosted JIRA instance which will allow you great flexibility in the logic to fill the target field in.
I finally managed to find a workaround for this.
Download the Workflow Enhancer for JIRA plugin (FREE). You would also need JIRA Suite Utilities (I had it installed already for some other customization)
In the Fixed to Reopen transition, add a Post Function and use Copy Value From Other Field to update Assignee from Developer field
Then add another Post Function underneath this where you need to use Universal Post Function. Here make the boolean condition as {Assignee}=="" and select Choose post function to execute: as Assign to Lead Developer
Publish the draft.

Implementing workflow in bestpractical.com RT

I would like to implement simple workflow system inside the Bestpractical RT.
My approach is:
Participant (RT user) creates or is given Workitem (Ticket) inside the Business Process (Queue)
OnResolve scrip checks change Ticket status to Open and change TicketOwner to next Participant.
OnReject scrip changes Ticket status to Open and gives it back to previous Participant.
My questions are:
- Is there good scrip examples to manipulate statuses?
- How can I debug scrips?
- How to disable built-in scrips for queues?
I read that it is possible to create a module for RT with actions which can then be called from scrips, but cannot find good documentation/examples. Please advise if you have one.
And the last question, how to enable developer mode in RT?
Thank you very much in advance,
Alexei
I'll assume you're running an RT version 4.0.x.
For the workflow you described, you probably want to create new tickets for each phase rather than having tickets set to resolved, then re-opening them. You can create new tickets in scrips to do this. You can also create link relationships between them like Depends On or Parent Child.
You can find user-contributed samples of various conditions on the RT wiki. You'll see a bunch of debug output for scrips if you turn on debug mode in your logging config. You can also put warn statements in code to see additional output in the RT logs. To disable scrips, edit the scrip and set the Stage to disabled. These built-in scrips are global, so if you want to set them per-queue, you can create scrips under the queue configuration to make them queue-specific.
The best examples of actions and conditions are the RT code itself. You can find documentation at the bottom of the main documentation page. From there, you can look in the lib directory in the RT code to see how the actions and conditions are implemented. It's generally easier to get started creating actions and conditions by selecting User defined and using the text boxes on the scrip edit page.
You can set devel mode in the configuration file. Make use you set these in RT_SiteConfig.pm, not Config.pm. You'll also want to set you log levels to debug.

Workflow does not execute through code but does execute otherwise + sharepoint 2007

I created a workflow through Sharepoint Designer 2007 that simply updates a list item when a change is made to a particular list item.
But the workflow executes when I make changes to the list item through Browser. But when same changes are made through code, it does not execute.
I was accessing the link with Elevated Privileges, i.e. through System Account. Due to Security reasons, Workflows dont run under System Account.
I had to impersonate as a user to access and modify the list. And workflow executed.

Resources