Set Finish Project Column via API - smartsheet-api

When I attempt to set the Finish column on a row in a sheet via the SmartSheet API, I get the following message:
{
"errorCode": 1080,
"message": "End Dates on dependency-enabled sheets cannot be created/updated. Please update either the Duration or Start Date column.",
"refId": "19ufon4xzsn7y",
"detail": {
"index": 0,
"rowId": 4987804240111492
}
}
If I want to clear the project dates for a specific row I can set the Duration and Start columns to null, but the Finish date remains. See https://smartsheet-platform.github.io/api-docs/#update-rows
What is the programmatic way to clear the project dates, including Finish, for a row?

I was able to update the Finish Date programmatically on a dependency enabled sheet via the API.
In order to do so I had to pass the date string in their specified format, and populate the strict property = true on both of the Start Date and Duration cell objects.
Using C#, you can get the date string formatted correctly using this
code: startDate.ToString("O")

I don't believe it's possible to programmatically update Finish date whenever dependencies are enabled for the sheet. Note, this is the sheet setting (in the Smartsheet UI) that specifies dependencies are enabled for a sheet:
If I manually uncheck this box and save the change via the Smartsheet UI, then I'm subsequently able to successfully update Finish dates via the API. Unfortunately it doesn't seem possible to disable dependencies for the sheet via API (i.e., the programmatic equivalent of unchecking this box). I tried doing so, but received an error indicating that you cannot set the dependenciesEnabled property via API.
REQUEST:
PUT /sheet/{sheetId)
{
"dependenciesEnabled": false
}
RESPONSE:
{
"errorCode": 1032,
"message": "The attribute(s) sheet.dependenciesEnabled are not allowed for this operation.",
"refId": "10pl3li0rs9b"
}

Related

How to get all-contributers github app to render table of contributors and badge?

I'm using https://github.com/all-contributors/all-contributors, and I've gone through every detail I can on their documentation https://allcontributors.org/ as well. And been trying different things for the past 2 hours but I can't get this app to render the table of contributors. Their documentation is incredibly poor.
I have:
{
"files": [
"readme.md",
"docs/authors.md",
"docs/contributors.md"
],
"imageSize": 100,
"contributorsPerLine": 7,
"contributorsSortAlphabetically": false,
"badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-pink.svg)](#contributors)",
"contributorTemplate": "<img src=\"<%= contributor.avatar_url %>\" width=\"<%= options.imageSize %>px;\" alt=\"\"/><br /><sub><b><%= contributor.name %></b></sub>",
"types": {
"contributor": {
"symbol": "❤️",
"description": "Contributor ❤️",
"link": "[<%= symbol %>](<%= url %> \"<%= description %>\"),"
}
},
"skipCi": true,
"contributors": [],
"projectName": ".github",
"projectOwner": "owner",
"repoType": "github",
"repoHost": "https://github.com"
}
I then use #all-contributors add #somename to code and it does correctly add it to the .all-contributersrc file, however it doesn't render the table in the readme.md.
I've also tried to hardcode the list in readme using:
<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
But no luck, nothing happens.
I also can not get the badge working. I can hardcode the badge and display "a" badge, but it never uses the above template badge with dynamic contributor length. So it's also not injecting the badge or using that template badge at all.
How can I get this bot to correctly show the badge and show the contributor list and generate the table in readme.md?
Note: I'm not interested in using node or running some generate command manually locally, then it defeats the point of using that app at all, then I can just as well do it myself. According to their documentation it should be generating the table automatically on first contributor, but it does not.
Also when I go to https://raw.githubusercontent.com/all-contributors/all-contributors/master/README.md in raw view, I can see:
Which tells me it has to be generating that table somehow, but it doesn't seem to work.
You can try and emulate other repositories using the same bot, like:
AtlasFoundation/AvatarCreator with this commit.
mrz1836/go-nownodes and its own .all-contributorsrc file
As an alternative, the estruyf/vscode-front-matter does include its own contributor list, using this commit which calls contrib.rocks.

Watson Conversation condition for checking if system entity #sys-date is today/yesterday

I'm trying to create a dialog with different response/action depending on a #sys-date system entity provided by the user. I know I can add conditions such as #sys-date.before('2018-01-24') where the compared value is fixed, but I have not been able to create a conditions that would check if the provided system entity is during today or during yesterday. Best I've tried is #sys-date.before(now().reformatDateTime('dd-MM-yyyy')) but even that does not seem to work like expected.
You can find out date for today and yesterday as follows:
{
"context": {
"date_today": "<? new Date().format('yyyy-MM-dd') ?>",
"date_yesterday": "<? new Date((new Date().getTime()) - (24*60*60*1000L)).format('yyyy-MM-dd') ?>"
}
These variables can be used then to compare the date in the system entity. E.g.
#sys-date.before($date_yesterday)

parse.com set undefined to date field in data browser

How can I set undefined or null and make empty to a date field in the parse.com data browser.
There is nothing related with code, in the pic i attached, you can see the parse.com data browser and i want to set undefined or null whatever and make that field empty but whenever i tried and double click the cell, data browser open date widget and it is not allowed to delete the data or there is no button to make empty.
Parse.com Data Browser
In data-browser I don't think it's possible to delete a date value, I couldn't find a way to do it at least.
And now that Parse.com will not be maintained anymore(in 01/01/2017 it will shut down), I don't think this may come up as a feature.
My solution to this problem was to make a request to this register and use unset. It gets a bit more of work but solves the problem.
I don't know if you're using parse with Javascript but it can be really easy to adapt to other enviroments.
In Javascript this script should do the trick:
var DateUpdate = Parse.Object.extend("MyTableOnParse");
var dateUpdateEdit = new Parse.Query(DateUpdate);
dateUpdateEdit.equalTo("objectId",myObjectId);
dateUpdateEdit.first({
success: function(object)
{
object.unset("saleDate");
object.save({
success: function(updatedObject)
{
console.log("Data deleted");
}
})
}
});

Change the status bar of an ADempiere window

How can I change the status bar text in an ADempiere window in order to show a message when a new record is created?
Also, how can I create a pop-up that appears when a new record is created?
You can put a message in center of window when a new record is created, this function already exists on iDempiere, but on ADempiere you'll need to change code for each docaction, or for each table you code is listening for.
On Idempiere you can check the code of class AbstractADWindowContent.java on package org.adempiere.ui.zk
check this link , line 2104
You can put a status message in status bar in Adempiere using the following method in org.compiere.model.GridTable
/**
* Create and fire Data Status Info Event
* #param AD_Message message
* #param info additional info
*/
protected void fireDataStatusIEvent (String AD_Message, String info)
{
DataStatusEvent e = createDSE();
e.setInfo(AD_Message, info, false,false);
fireDataStatusChanged (e);
}
You will find an example of its use within the same class, when a row is saved via the dataSave(boolean) method. If all goes to plan and record is saved at the end of the method you'll see
fireDataStatusIEvent("Saved", "");
This puts the default “Saved” message see in the application when you click save in any tab.
There are two recommended approaches to customising Adempiere.
Callouts; are used to add complex defaulting & validation in the
User Interface
Model Validators; are used to apply business logic or validation when a number of data model events, such as a record being saved, occur. But, not all changes are happening at the time the UI events are occurring... as with the accounting module, for example, so the model validator mechanisms assume no user interface exists.
Your requirement to have something happen in the UI when a data model event occurs falls between the two. For your requirement it might be easiest just to modify this default message (highlighted above in dataSave()) to display what you would like. But GridTable is at the core of the application so keep in mind that any time you update/upgrade Adempiere in the future you will need to make this modification again!

Salesforce Apex Trigger "isAPI" Context Variable

Is there a way to determine if a trigger is being executed by an API call or through the Salesforce Web Interface?
I'd like to do something like this:
trigger Update_Last_Modified_By_API on My_Object__c (before update) {
for (My_Object__c o : Trigger.New) {
if (isAPI) {
o.Last_Modified_By_API__c = datetime.now();
}
}
}
(Currently using API version 25.0, though will soon be updating to 26.0)
There is currently no standard way to tell within the trigger what actually caused an update or insert to happen (API, standard page layout, VF page & controller, some other Apex code, etc.). Here's a full list of Trigger Context Variables.
To achieve this, I would suggest creating a custom checkbox field on the object, something like IsAPI__c (with a default value of false). Then all you would need to do is pass in true for that field with any API call, and then check the field in your trigger for each record in the batch (just make sure you remember to reset it to false when you're done so subsequent calls from the UI aren't treated as API calls).
trigger Update_Last_Modified_By_API on My_Object__c (before update) {
for ( My_Object__c o : Trigger.New ) {
if ( o.IsAPI__c ) {
o.Last_Modified_By_API__c = datetime.now();
}
o.IsAPI__c = false;
}
}
If you're just trying to determine whether a transaction was initiated via the UI or not, using the System.URL.getCurrentRequestUrl() method might give you an indication.