Why every time Create a new record I found ID increment by 2 not in normal way? - dynamics-crm-2011

Why every time I Create a new record I found ID increment by 2 not in normal way ?ScreenShot

Best guess is that there is a workflow or plugin that is creating a duplicate, and that duplicate isn't showing in your query, or is being deleted by the plugin/workflow.

Related

How should I extend the TTL of a document in Azure CosmosDB using the Python SDK?

I'm working with a Cosmos DB database with the SQL API. I have a container with TTL policy of 6 months. When a certain action is taken, my code receives an id and need to extend the deletion time for the item with that id in that container to now + 6 months. What is the recommended way to do this? An empty upsert?
I can assume the document exists.
The documents only need to be deleted in approximately six months. I'm not worried about exact timing.
I'm using the Python SDK. I looked through the documentation, but I could not find anything like an "extend" operation.
Should I not be leveraging the TTL? Should I be doing something else?
If you want to change to a different TTL on that particular item, just add or update the 'ttl' field to the desired number of seconds.
example copied straight from the docs:
item = container.read_item(
item='SO05',
partition_key='CO18009186470'
)
# Update ttl to 2 hours
item['ttl'] = 60 * 60 * 2
container.replace_item(
item='SO05',
body=item
)
basically it adds those seconds to the '_ts' field to set the time of deletion
Any update on the document resets the timestamp of that document (the _ts property).
The TTL basically acts based on that value.
So in your case, a simple Replace operation over that document would reset the timestamp so it would effectively be deleted 6 months after this last update.

Internal Ids generated on Netsuite custom records not sequential

I have created two custom record types in Netsuite, for one of the record types when I am inserting new records via script I am seeing the internal ids are 1, 101, 201, 301 etc instead of 1,2,3,4.
While on the other custom record its as expected. Is it something wrong on the custom record creation or am I missing something?
No. Internal ID's can be created differently when done in batches, deleted, or because it's a day that ends in "y". It's standard behavior. Rest easy.
On the Custom Record itself check the "Numbering" tab. Reference Suite Answer Id: 10146. Check the Enable box to turn on automatic numbering. Check the Allow Override box if you want to be able to enter a custom number. Check the Update box to number record instances that have already been created.

NetSuite - Deleting Time Entry Records

Has anyone figured out a way to delete a time entry record from a time sheet record, without actually deleting the time sheet? My use case is that I have been syncing work time from JIRA to NetSuite for over a year now. When there is an error or they need to update their time, my integration just deletes it and recreates everything. Never an issue, since the time sheets are not submitted or approved yet, at that point.
Now, we have installed this SuitePeople bundle (sadly, the project managers working on that did not test anything...:/ ), which has completely changed time tracking. Aside from custom fields no longer showing up in the columns (a whole different issue), they are now generating generic timesheets for people to show time off. Those time sheets are not able to be deleted, and their time entries are not able to even be edited (presumably since they were created by the system - at least that's what NetSuite says).
My last hope is to add/edit/delete time entry records when the additional system generated time sheets have been added. But, anytime I try to delete a time entry, I'm given the error that timeentry is not a valid record type (since it is a subrecord).
Any thoughts? Feeling completely at a loss here...
This is good to know since I have a direct integration with JIRA worklogs as well but no SuitePeople.
Can you cancel/reject the timesheet?
Turned out that I had to run this through a RESTlet, where SuiteScript is able to directly search and delete time entry records. Here are the important parts of that script, in case anyone runs into this as well.
var timeEntrySearch=search.create({
type:'timeentry',
columns:[{name:'employee'},{name:'hours'},{name:'internalid'},{name:'memo'}],
filters:[{name:'date',operator:'within',values:[startDate,endDate]},{name:'employee',operator:'is',values:[userID]}]
}).run().each(function(result){
log.debug('results',JSON.stringify(result));
var memoField=result.getValue({name:'memo'});
if(memoField.indexOf('JIRA Time')!=-1){responseArray.push(result);}
return true;
});
for(var el in responseArray){
try{
log.debug('Deleting',JSON.stringify(responseArray[el].id));
record.delete({type:'timeentry',id:responseArray[el].id});
}catch(deleteErr01){
log.debug('ERROR[deleteErr01]',JSON.stringify(deleteErr01));
continue;
}
}

SuiteScript Create Record has an ID

I am curious about something in SuiteScript and I am not finding an answer easily.
When a record is created in SuiteScript: nlapiCreateRecord('recordType', {recordmode:'dynamic'});, I am curious to know if the record's ID is also created. Or does that process only happen on the nlapiSubmitRecord(); command?
Thanks!
nlapiCreateRecord() only initializes the record and returns an nlobjRecord object for your script to work on. Nothing is committed to the database until you submit the record using nlapiRecordSubmit(). The application cannot decide what the internal id will be until submitted, as other records could be added between when the record is created and when it's submitted.

How to differentiate new items from existing items in SharePoint workflow

I have a SPD workflow that is set to run when an item changes but it keeps getting triggered on new items, which is pretty annoying. I'm looking into why this is happening but I'm also looking for a way to terminate the workflow if the item is new as a temporary workaround.
I tried to compare the Created field to the Modified field i.e. if Created and Modified are the same then don't run. This didn't work, either as a date or string comparison.
Any suggestions would be much appreciated.
Store a flag in a hidden field the first time the workflow is run. Check if the flag is present, if not then it is the first time (created), otherwise it is updated.
I have faced this same issue and I solved with the workaround like this
Take created date and add 1 minute with it and assign it to a variable
Check this variable less than current time.
It done with the following assumption
a. No one try t edit the item within one minute, it created
b. Workflow will execute within one minete
In my case it was success
The comparison between the created time and modified time works on SharePoint 2010 (it is used here). Perhaps the comparison is done incorrectly or the wrong object is used to get the data from?
If said approach does not work on 2007, perhaps it may be possible to use the owshiddenversion field (directly access as property if not correctly exposed). It should be 1 for a newly created item, and > 1 otherwise. It may only be available on versioned lists, I do not recall.
Try adding a condition which compares the create date with the modified date.
i.e.: if current item:created not equals current item:modified

Resources