How to migrate a particular state of a workitems ( i.e Only active state of workitems) under the VstsSyncMigrator Tool - azure-devops-migration-tools

I am using the tool version of V11.9.20. I have successfully migrated all workitems on one of my production move.
Now the requirement is there need to move only the active workitems. For that I have configured the below json fie. But result is showing me Active state along with proposed and resolved state.
Could you please help me out if I need to migrate only one state or multiple state. Please advice.
I have configured as follows on my json file.
{
"$type": "FieldValueMapConfig",
"WorkItemTypeName": "*",
"sourceField": "System.State",
"targetField": "System.State",
//"defaultValue": "New",
"valueMapping": {
//"Approved": "New",
//"New": "New",
"Active": "Active"
//"In Progress": "In Progress",
//"To Do": "New",
//"Done": "Closed",
//"Removed": "Removed"
}
Thank you!
-Asit

The value mapping feature does not filter the work item list, it allows you to mat one state to another state.
You should add [System.State] = 'Active' to the query.

Related

Is there a way to pull the "Display Name" rather than the field name from Rest API for SuiteCRM

So looking to pull in the info from Source_C but only getting back the field value
Lets say my sources in source_c are;
Field Name
Email_Mass_Mail
Email_Direct_Email
Meeting_Request
Meeting_Submit
And the Display Name for those sources are;
Display Name
Mailchip Email
Direct Email
Email Referral
Website Submission
I am currently only getting Field Name values back but I want to have Display Name as its more friendly for the end users.
You should get (and probably cache) the list of fields for that module.
You can get it from Api/V8/meta/fields/Accounts - Accounts is the module name.
You will get a list of all the fields
{
"data": {
"type": "fields",
"attributes": {
"id": {
"type": "id",
"required": true,
"dbType": "id"
},
"name": {
"type": "name",
"dbType": "varchar",
"len": 150,
"required": true
},
Sadly, there is a pending issue with enum/multienum that is not showing the list on the API call. Its confirmed and set as High priority so I expect to be fixed soon (soon for SuiteCRM is a couple of months) https://github.com/salesagility/SuiteCRM/issues/8622

Query TFS to show all releases and whether or not it is set for approval. V 2017.3

I need to run a query in sql that will show all the TFS releases from all projects and whether or not it is setup for pre relase approvals. I see in the defaultcollection db there is the Release.tbl_ReleaseDefinition table, it has a lot of data but not approval info. I do see the Release.tbl_DefinitionEnvironment and I see ApprovalOptions there, but that seems to be showing the approval info for every release created whereas I am needing info on release definitions only.
Just as Daniel pointed out, we highly not recommend you dig into TFS databased directly.
According to your description, you just need the approval info for all release definitions. Suggest you use Rest API to handle this.
For a single release, you could use below Rest API:
GET https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions/{definitionId}?api-version=5.1
It will return both preDeployApprovals and postDeployApprovals, for example:
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": false,
"isNotificationOn": false,
"approver": {
"displayName": "Chuck Reinhart",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/aeb95c63-4fac-4948-84ce-711b0a9dda97",
"_links": {
"avatar": {
"href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aad.YjYxMjE5ZWQtODEwYS03OTU3LWJjYzAtMjQ0YTI5ZDk0ZjFl"
}
},
"id": "aeb95c63-4fac-4948-84ce-711b0a9dda97",
"uniqueName": "fabfiber#outlook.com",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=aeb95c63-4fac-4948-84ce-711b0a9dda97",
"descriptor": "aad.YjYxMjE5ZWQtODEwYS03OTU3LWJjYzAtMjQ0YTI5ZDk0ZjFl"
},
"id": 118
}
],
More details please take a look at official doc here: Definitions - Get
For multiple release, you should use list: Definitions - List
Hope this helps.

Detecting Google Drive changes

I'm quite confused by how to operate the changes API.
At the moment, I'm just making get requests:
https://www.googleapis.com/drive/v3/changes?access_token=**my_token**&pageToken=68485 **Last few additions to the list
I get:
{
"kind": "drive#changeList",
"newStartPageToken": "68489",
"changes": [
{
"kind": "drive#change",
"type": "file",
"time": "2017-04-08T00:40:36.141Z",
"removed": false,
"fileId": "***ID",
"file": {
"kind": "drive#file",
"id": "***ID",
"name": "***NAME",
"mimeType": "application/vnd.google-apps.folder"
}
},
{
"kind": "drive#change",
"type": "file",
"time": "2017-04-08T00:41:00.171Z",
"removed": false,
"fileId": "***ID2",
"file": {
"kind": "drive#file",
"id": "***ID2",
"name": "***NAME2",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
}
]
I'm not aware of making changes to the first item in the changes array.
After playing around, I realised that every time a folder is opened it's added to the changes, why? Is it because the meta-data is being changes, i.e. last-accessed?
Does the same thing happen when files are previewed/opened/downloaded?
I trashed the second item in the array, yet it shows nothing about this.
How exactly am I to tell what is being changed. I'm trying to retrieve events such as file updates, creations, deletions etc.
The official properties that Changes uses which are found in the Changes resource representations:
{
"kind": "drive#change",
"type": string,
"time": datetime,
"removed": boolean,
"fileId": string,
"file": files Resource,
"teamDriveId": string,
"teamDrive": teamdrives Resource
}
Now this might not make a complete answer but I'd like to share some points.
Is it because the meta-data is being changes, i.e. last-accessed?
Yes, it is. It's a bit strange but yes, even previewing the file counts as a change. If you've closely watched the Drive's Android App, you can see that just viewing a photo will populate it under the "Recents" tab.
In API v2, there was even a files.touch() method, just for updating the last accessed time of a file!
How exactly am I to tell what is being changed?
There is a property named changes[] returned by changes.list() which is a list containing the changes. You could use this to determine if the change was relevant to you (like updation, creation, deletion) or ignore if it was just a preview.
To add to this, instead of continuously checking for changes, a more efficient way to detect changes is by using the changes.watch() method to subscribe for updates to the changes, which I hope you are already aware of.
And about trashing. Trashing doesn't really "change" a file in Drive. A trashed file is treated just like an ordinary file with the exception of having "Trashed" flag, which makes it directly invisible. Note that shared files are still accessible by collaborators, even if it's trashed. However, change should fire if the file is permanently deleted.

Accessing previous state of resource from gitlab webhooks

In implementing a custom webhook handler for Gitlab issues, I'm struggling to find out how to determine the previous value of a field before the hook fired.
For reference, this is the webhooks documention, and an issue-specific payload looks a bit like:
{
"object_attributes": {
"action": "update",
"url": "https://example.com/foo/bar/issues/10",
"iid": 10,
"state": "opened",
"milestone_id": null,
"description": "44",
"branch_name": null,
"position": 0,
"updated_at": "2015-11-07 17:39:47 +0000",
"created_at": "2015-11-07 17:06:07 +0000",
"project_id": 51,
"author_id": 6,
"assignee_id": null,
"title": "123",
"id": 180
},
"user": {
"avatar_url": "https://example.com/uploads/user/avatar/6.jpg",
"username": "shabble",
"name": "real name"
},
"object_kind": "issue"
}
when an issue is modified.
In this example, the assignee_id was changed from myself to null, but there appears to be no way to determine what the previous value (that is, me) was prior to update.
This is the same for almost all editable fields, including things like the entire issue description. So it's possible to tell what it is now, and maybe when it was last changed, but not see any of the previous changes.
Is there anywhere this information (previous state) can be found, perhaps via the gitlab issues API although I've not found anything plausible.
The only option seems to be a separate system to record the values from every hook, and then when a subsequent hook comes in that matches the same issue, diff the last record to determine changes. This would be less than ideal.
Any other ideas?

Is it possible to retrieve an extended or full query history in google bigquery?

I recently discovered I accidentally deleted a table from BigQuery, which was constructed by querying other tables (which I still have).
As table deletes in BigQuery are permanent (right?), I would like to reconstruct the lost table, preferably without rewriting the query.
The Query History in the webUI obviously only displays a limited number of queries. The one I am looking for is unfortunately not in that list.
So my question is, is it possible to somehow recover the queries which have disappeared from the query history?
(I do know the creation date of the query I am looking for)
In the CLI, you can run bq ls -j -a to retrieve jobs for all users in a project.
Then you can run for each job id a bq show -j <job_id> and in order to have more details you will choose to use the json response:
bq show --format=prettyjson -j job_joQEqPwOiOoBlOhDBEgKxQAlKJQ
this returns the following format which have your query, your user and bytesprocessed etc...
{
"configuration": {
"dryRun": false,
"query": {
"createDisposition": "CREATE_IF_NEEDED",
"destinationTable": {
"datasetId": "",
"projectId": "",
"tableId": ""
},
"query": "",
"writeDisposition": "WRITE_TRUNCATE"
}
},
"etag": "",
"id": "",
"jobReference": {
"jobId": "",
"projectId": ""
},
"kind": "bigquery#job",
"selfLink": "",
"statistics": {
"creationTime": "1435006022346",
"endTime": "1435006144730",
"query": {
"cacheHit": false,
"totalBytesProcessed": "105922683030"
},
"startTime": "1435006023171",
"totalBytesProcessed": "105922683030"
},
"status": {
"state": "DONE"
},
"user_email": ""
}
Using the API you need to pass allUsers property to list jobs from all users https://cloud.google.com/bigquery/docs/reference/v2/jobs/list#allUsers
Using the JobID, you can query for a specific job (documented here). This will give you a Jobs resource, which will contain your query.
If you don't know the JobID... it depends on how the query was ran I assume. It's possibly logged by the App Engine (if you ran it via code) in the Logs section of the Developer console. You could also take a look at the Jobs List (credit to the OP for that one) and look in there for your recent jobs. From the list you get Jobs Resources as well, so they will contain all you need.
This can be done using stackdriver audit logs. Here is more info.
Even if you haven't set up the stackdriver logging you can still try to find your query. BigQuery logs are enabled by default and you can retrieve those from stackdriver within 30 days.