Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Unable to create a distribution list on a new task through the API

Hi,

we have a business case to copy a task from environment A to environment B, so we basically do that by providing a UI that allows a user to select a task from env A and configure a list of named users permissable for environment B.

in the backend this is translated into two QMC API objects source and destination, which we then merge by setting the relevant fields on the destination documenttask, and manually recreating the Distribute property. Unfortunately when I do that the distribution entry is not shown on QMC and I have no idea why.

We use a generic QlikViewHelper class to wrap calls to the QMC API.

All classes in use are provided as attachments.

Any chance you guys can shed some light? I noticed on another thread there are inconsistencies in behaviour from the API that are triggered by unrelated fields to the ones you are trying to set, so that might perfectly be the case here.

1 Solution

Accepted Solutions
Not applicable
Author

I found the issue, apparently the Document property was being set with a User Document instead of a Source Document because I was querying the API for User Documents. After I changed that, the creation started working normally.

Thanks all for the helpful questions and suggestions

View solution in original post

12 Replies
agomes1971
Specialist II
Specialist II

Hi,

just analyzing your program.cs where is your user and password or they are in the config file?

Regards

André Gomes

Not applicable
Author

in the config file, i thought that was irrelevant since you would have to enter your own credentials to connect to your own system over there.,..

agomes1971
Specialist II
Specialist II

So you've already done this right?

Step 1 – Set Permissions


To be able to make calls to the management service the request needs to come from a user context with membership of a specific group on the QlikView server.  For most API calls the user needs to be a member of the “QlikView Management API” group, this groups is not created by the QlikView installer and so must be created and the relevant users added.

Regards

André Gomes

Not applicable
Author

Yes, I am able to actually connect to the server, list all tasks, load a specific one and save the new one, but the distribute portion of the new task is corrupted somehow, and it doesnt show any information. When trying to close the task detail screen by clicking the cancel button I get a popup error saying "Not found: SourceDocuments.TaskProperties.Cancel". I will add screenshots of the QMC and the popup

agomes1971
Specialist II
Specialist II

OK.

simondachstr
Luminary Alumni
Luminary Alumni

Hi Ricardo,

I hope you'll take it as constructive feedback that your code is very poorly commented making it hard to figure out exactly what you've done and why and most importantly what you have possibly missed out.

One thing I see is you're trying to create a document task on environment B from scratch (new DocumentTask) based on information from environment A. My suggestion is to try (for the sake of debugging) a different approach:

Create a generic task in environment B where the distribution is working absolutely fine. Then instead of creating a new task, just take this generic one in B and reassign it with (all) the values of the task from environment A. Do that and check if the distribution is still affected. If yes, then your reassignment of values is flawed, if not, you've probably missed out some properties in the new DocumentTask.

Not applicable
Author

When I was debugging I noticed I wasnt saving with scope including Distribute so I tried adding that, but I got a n exception during the save operation:

System.Exception: Document tasks belonging to user documents can only be saved with Scope property set to one or more of General, Reload, DocumentInfo or Triggering

Not applicable
Author

Hi Martin,

I take your comments as constructive of course.

I will try to spend some time adding comments to this draft code.

In my current settings there is only 1 environment *sandbox*, i can try the way you are suggesting, I'll use one of the tasks already on the server for it

Not applicable
Author

I found the issue, apparently the Document property was being set with a User Document instead of a Source Document because I was querying the API for User Documents. After I changed that, the creation started working normally.

Thanks all for the helpful questions and suggestions