< Back

Get-ProvDyn365Entity

Sun Jan 19, 2020 5:38 pm

NAME Get-ProvDyn365Entity



SYNOPSIS

Get an entity from a Dynamics365/Provance ITSM instance via the Web-API.





SYNTAX

Get-ProvDyn365Entity -AlternateKey <string> -AuthContext <object> -EntityName <string> [-APIVersion <string>]

[-IncludeFormattedValue <SwitchParameter>] [-SelectSection <string>] [-TopSection <int>] [<CommonParameters>]



Get-ProvDyn365Entity -AuthContext <object> -EntityName <string> -Id <Guid> [-APIVersion <string>]

[-IncludeFormattedValue <SwitchParameter>] [-SelectSection <string>] [-TopSection <int>] [<CommonParameters>]



Get-ProvDyn365Entity -AuthContext <object> [-APIVersion <string>] [-EntityName <string>] [-FilterSection <string>]

[-IncludeFormattedValue <SwitchParameter>] [-SelectSection <string>] [-TopSection <int>] [<CommonParameters>]





DESCRIPTION

This cmdlet connects to a Dynamics365/ProvanceITSM instance and reads entities based on ID, alternate Key or on a

filter criteria



It supports 3 different Parametersets.



1.) "Entity by Filter" This parameter set allows you to filter entities by a specific field and its content. To

use this parameterset you need two parameters: -EntityName and -FilterSelection



2.) "Entity by ID" Each Dynamics365/ProvanceITSM entity has a unique identifier, created by Dynamics365. When you

know this ID, you can get the entity by this GUID. Parameters used are: -EntityName and -ID Hint: To get the ID,

either use Get-ProvDyn365Entity with the -FilterSelect Parameterset, or record it during creation with

New-ProvDyn365Entity



3.) "Entity by Alternate Key" Entities in Dynamics 365 have the GUID as their primary Key. By customizations, you

can define an alternate Key. To figure out if your entity has an alternate key open your Dynamics 365 instance in

a browser and go to: Settings ==> Customizations ==> Customize the System ==> Entities ==> Select your entity ==>

Keys If you find one or more entities in this list, you can use them as an alternate key. Parameters used are:

-entityName and -alternateKey



The cmdlet generates a key/value pair list of the data coming from the Dynamics365 WebAPI. By default, the Web-API

sends a maximum of 5000 objects and all fields of an entity, which can be limited with the -TopSelection Parameter





PARAMETERS

-AuthContext <object>

The Authentication context generated by Get-ProvAzureAuthContext



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-EntityName <string>

The logical name of the entity in Dynamics365/ProvanceITSM. This value is case sensitive !



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Id <Guid>

The GUID(id) of the entity generated by Dynamics365/ProvanceITSM.



Required? true

Position? named

Default value 00000000-0000-0000-0000-000000000000

Accept pipeline input? false

Accept wildcard characters? false



-AlternateKey <string>

The Alternate Key of the entity in Dynamics365/ProvanceITSM.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SelectSection <string>

The output filter for the entities, defined by a field name array, i.e. "name,address1". (PS: the id of the

entity will always be returned) When you select more than one value put the values inside quotes and seperate

them by commas.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-FilterSection <string>

The input filter for the selection, i.e. "contains(name,'Contoso')". Other examples for a filter is:

"startswith(apitil_name,'Apple')" You can also combine filters with logical arguments like this example:

"startswith(apitil_name,'Apple') and contains(apitil_description,'service')" use https://docs.microsoft.com/en-

us/dynamics365/customer-engagement/developer/webapi/query-data-web-api?view=dynamics-ce-odata-9 for examples

how to use the filter



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TopSection <int>

The output can be limited to a maximum amount". use this parameter, when you expect a large amount of objects

and want to limit them to a specific number.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-IncludeFormattedValue <SwitchParameter>





Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-APIVersion <string>

The Web-API Version used to query. Default is 'v9.0'".



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.Collections.Hashtable





---------- EXAMPLE 1 ----------



Get entities by a filter and show the name and id





Get-ProvDyn365Entity -AuthContext $token -EntityName 'account' -FilterSection "contains(name,'Fabrikam')"

-SelectSection 'name'



Parameterset used is "Entity by Filter", and we look for the entity type "accounts"

in the entity 'accounts', ther is a field called 'name'. Our filter criteria looks

for all entities where the name contains the word 'Fabrikam'.

As the cmdlet would show all fields, we limit the output to 'name' with the -SelectSection parameter.

When you test this, the cmdlet will also output the id, which is a default setting and cannot be changed.

The $token object is generated by the cmdlet Provance.AzureAuthcontext which can be found in the Provance.Azure

Module.



---------- EXAMPLE 2 ----------



Get entities by id and show all fields





Get-ProvDyn365Entity -AuthContext $token -EntityName 'account' -id '2a01fcb8-d877-42fd-b700-b3da13d8f472'



Parameterset used is "Entity by id", and we look for the entity type accounts

where the entity GUID (id) has the value of the above example.

The $token object is generated by the cmdlet Provance.AzureAuthcontext which can be found in the Provance.Azure

Module.



---------- EXAMPLE 3 ----------



Get entities by alternate Key and show some





Get-ProvDyn365Entity -AuthContext $token -Entity 'apitil_coudtenant' -alternateKey

'2a01fcb8-d877-42fd-b700-b3da13d8f472' -SelectSection 'apitil_name,statuscode'



Parameterset used is "Entity by Alternateid", and we look for an entity of type "apitil_cloudtenant"

where the alternate key of the entity has the value of the above example.

To reduce the number of output field, we limit the fields to "apitil_name" and "statecode" with the select

parameter

The $token object is generated by the cmdlet Provance.AzureAuthcontext which can be found in the Provance.Azure

Module.





RELATED LINKS

Provance Technologies Inc. (http://provance.com)

Help (http://help.provance.com)