RangerMSP Business Automation for successful ITs

 
September 14th, 2020, 12:32 PM
CraigYellick
 
Posts: 53
A large number of assets were created with a default contract as a specific contract and not as a series contract.

There is nothing in the API documentation about how to set this. Looking at an Asset object in the debugger, I don't see anything related to contracts.

In the raw database table for Assets I can see a CONTRACTRECID field, shows a normal contract RecID for a specific, and an asterisk-prefixed code that I presume is found in the BContractSeries table but I can't locate a matching record.

Any advice will be much appreciated!
 
September 14th, 2020, 01:02 PM
CraigYellick
 
Posts: 53
Follow-up: I found I can do this --

asset.SetFieldValue("FLDASTCONTRACTID", contract.ContractID)

But that is setting it as a specific contract. What's the equivalent for series?
 
September 15th, 2020, 06:09 AM
Support Team
 
Posts: 7,514
Thank you for posting this.

Once the Contract Series is set to the Asset, field FLDASTCONTRACTID is populated with a value from Contract.SEQID field - prefixed with asterisk.

The Contracts.SEQID (without the asterisk) equals to BContractSeries.SEQID.

Hope this helps.
 
September 15th, 2020, 07:14 AM
CraigYellick
 
Posts: 53
Thanks, I'll give this a try. My confusion here is that while I see the SeqID in the BContracts table and can get to it via the specific contract RecID, I cannot find the SeqID in the BContractSeries table.
 
September 15th, 2020, 08:00 AM
Support Team
 
Posts: 7,514
SEQID is the unique / key field in the BContractsSeries, like RECID in other tables.
This value groups all contract-instances belonging to the same series.

Using the BContracts.SEQID field should work for you.

Hope this helps.
 
September 15th, 2020, 08:05 AM
CraigYellick
 
Posts: 53
Sure, will give it a try. My concern is that the query below yields six records that are all part of this series, as expected. So clearly it's a legit SeqID

select * from bcontracts where seqid = 'ZVDXHL6HO28AMPQ9VQ4H'

However, this next query returns zero records and I was expecting to see exactly one.

select * from bcontractseries where seqid = 'ZVDXHL6HO28AMPQ9VQ4H'

I'll work on the API code this morning and hopefully it'll "just work" and I don't need to solve the mystery of the bcontractseries table.
 
September 15th, 2020, 09:01 AM
Support Team
 
Posts: 7,514
The record is added to BContractSeries table only if the Contract is set to auto-renew.

Hope it helps and makes sense.
 
September 15th, 2020, 10:37 AM
CraigYellick
 
Posts: 53
Got it, that makes sense.

Almost have this API code running but there's zero documentation on Contracts in the API references. I have successfully fetched a contract object and now need to extract the SeqID from it. There's no SeqID property on the object so I'll need the field name for the Get as illustrated below.

SeqID = contract.GetFieldValue("??")

If this actually is documented somewhere I'd be happy to go there and discover all of this.
 
September 15th, 2020, 01:48 PM
Support Team
 
Posts: 7,514
Yep, unlike other areas, there is no documentation*for the working-but-still-unofficial Contracts API. It's on our list and be publicly available once we announce it officially.

Please use FLDBCTSEQID.

Hope this helps.
 
September 15th, 2020, 01:58 PM
CraigYellick
 
Posts: 53
I guessed that FLDBCTSEQID might be the name, based on experience with other objects. It's always blank. Argh -- now I am getting it, that field is not part of the default set of values that are returned from queries. I'm making progress!
 
September 16th, 2020, 09:55 AM
CraigYellick
 
Posts: 53
Success, I'm able to set assets with a specific contract to a series contract. This is based on running a series of single record test cases.

However, in a batch mode for some (not all) assets I get an error saying that the Type and Name fields are required when I call the asset.Save() method. Looking in the debugger, there are values for both in the asset object.

This error is off-topic for this thread so let me know if I should create a new thread.
 
September 16th, 2020, 11:36 AM
Support Team
 
Posts: 7,514
Great!!!

Regarding the other item, please share the logs files with us over email, hopefully we'll learn what in the API call returns this message.
 
September 16th, 2020, 11:52 AM
CraigYellick
 
Posts: 53
Log files in a .zip are heading your way. The error occurred during an asset.Save() call if that helps narrow it down.
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search



All times are GMT -6. The time now is 07:40 PM.

Archive - Top    

RangerMSP - A PSA software designed for MSPs and IT Services Providers
Forum Software Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.