Contributions
Re: Accessing internalCustomFields for Triggers in Collaborator
I heard back from SmartBear that there's no supported way to access the fields as a variable in the Trigger. I just wanted to post my workaround in case it helps anyone else. I created this python script to parse JSON, inspired by this stackoverflow post:http://stackoverflow.com/a/8400375 . (You should be able to replace it with pretty much any json parsing library though). #! /bin/python import sys,json if len(sys.argv) != 2: sys.stderr.write('Usage: ' + sys.argv[0] + " [requested attribute(s)]\n") sys.stderr.write(' For example: ' + sys.arg[v] + ' "obj[0]"' + "\n") sys.stderr.write(" This would get you the first element of the list in the JSON object passed to the script via stdin\n") obj=json.load(sys.stdin) try: exec "sys.stdout.write(json.dumps(" + sys.argv[1] + "))" except ( AttributeError, KeyError ): sys.stderr.write('Error: Requested JSON attribute does not exist.') sys.stderr.write(' Requested: ' + sys.argv[1]) sys.stderr.write(' JSON: ' + json.dumps(obj)) Assuming that this script lives at /bin/parse-json on the same machine, I wrote the following script to get the internal JiraIssueId field: #! /bin/bash collaboratorReviewId=$1; if [ -z $collaboratorReviewId ]; then echo "Code Collaborator Review Id is required"; exit 2; fi serverUrl="http://collaborator.server"; commandUrl="$serverUrl/services/json/v1" data='[{"command":"ReviewService.findReviewById","args":{"reviewId":"'$collaboratorReviewId'"}}]'; jiraIssueId=$(curl -X "POST" -H "Content-Type: application/json" -d $data $commandUrl | /bin/parse-json '[field["value"][0] for field in obj[0]["result"]["internalCustomFields"] if field["name"] == "JiraIssueId"][0]' | sed -e 's/"//g'); # Do whatever you want with the $jiraIssueId here There are some obvious downsides to this approach, but I think it should work for now.2KViews0likes0CommentsAccessing internalCustomFields for Triggers in Collaborator
Hello world, I can use the http://collaborator.server/services/json/v1 API with the following JSON body to get data about a review. [ { "command" : "ReviewService.findReviewById", "args" : { "reviewId" : "42" } }] Specifically, it includes the following internalCustomFields key: "internalCustomFields" : [ { "name" : "JiraIssueId", "value" : [ "10600" ] }, { "name" : "ExternalTaskId", "value" : [ "" ] } ] I would like to use this JiraIssueId field for a review as an argument to one of the configurable Triggers (say Review Phase Changed for example). Does anyone know how I would access this internal field? I know I can use ${review.custom.foo} for visible custom fields that I create, but the internal custom fields are not documented in the http://collaborator.server/manual/index.html?admin_var_subst.html documentation. I've tried ${review.internal.JiraIssueId}, ${review.internalCustomFields.JiraIssueId}, and ${review.custom.JiraIssueId} but none of them work (giving me the following error) Error: Invalid input: Parameters: ${review.internalCustom.JiraIssueId} is not a valid substitution keyword Thanks for any help! Best, ~Chris2KViews0likes1CommentRe: How can one use triggers in Collaborator?
Hi Santia2c, I don't work at Collaborator so I'll defer to anyone official. From what I can tell though, the configurable Triggers from the admin menu can only be used to run scripts.Additionally, they are only executed after the trigger occurs. For this reason, I don't think there's a way to use the Triggers functionality to interrupt the user from advancing phases with a popup. There might be an alternate way to accomplish this that I'm unaware of though; again I'll defer to SmartBear here. Best, ~Chris2.7KViews0likes0CommentsHow can I resolve "content for version #x is not available" when content exists on server?
Hello world, When trying to view a diff, I'm seeing an error message: Content for version #4 is not available - it was probably archived by your administrator. (Content MD5: 0b5cc2fd6db3e718e772f17fa4ed0ce7) As an administrator, I can verify that no one intentionally archived that file. What's more, is that I can still find the contents of the diff at [CacheRootLocation]/0b/5c/0b5cc2fd6db3e718e772f17fa4ed0ce7. Has anyone experienced this issue before? Does anyone know how I could resolve this? I've tried restarting the server; deleting the file and restarting the server; and restoring the file and restarting the server. This is happening for other files in the same review and for all the files in a few other reviews as well. I doubtit's related, but we renewed our license between the time when those reviews were created and now when we're trying to view the diffs. Thanks for any help! Best, ~Chris1.6KViews1like1Comment