This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Strange same PcmsQuery behaviour with a variety of users.

Hi all,

I was using PcmsQuery Function to get only the latest version of File and to know if the file is approved or not.

The problem that PcmsQuery works well with my account, but not to all users.

In my test, I use the same setting like the same product_name and the same expected_resultat.

From where can be the issue, please.

You find it below the code that I used.

		PcmsObjStruct itemObj = { 0 };
		int noUids = 0;
		int* uids = nullptr;
		int i = 0;
		itemObj.objType = PCMS_ITEM;
		itemObj.noAttrs = 2;
		itemObj.attrs = (PcmsObjAttrStruct*)PcmsEvntCalloc(sizeof(PcmsObjAttrStruct)* itemObj.noAttrs);
		#define SET_ATTR(_attr,_value,p) \
		{\
			register int x = p;\
			x--;\
			itemObj.attrs[x].attr = _attr;\
			PcmsSvaSetVal(itemObj.attrs[x].value,_value,0);\
			p++;\
		}
		i = 1;
		SET_ATTR(PCMS_ATTR_PRODUCT_ID, product, i);
		SET_ATTR(PCMS_ATTR_FILENAME, fileName, i);

		if (PcmsQuery(connectionID, &itemObj, PCMS_OPT_LATEST, &noUids, &uids) == PCMS_OK && noUids)
		{
			for (i = 0; i < noUids; i++)
			{
				if (PcmsInitUid(connectionID, uids[i], PCMS_ITEM, &itemObj) != PCMS_OK)
					continue;
				if (strcmp(itemObj.status, expectedStatus) == 0)
				{
					PcmsObjFree(&itemObj);
					PcmsEvntFree(uids);
					return PCMS_OK;
				}
			}
		}
		PcmsObjFree(&itemObj);
		PcmsEvntFree(uids);
		return PCMS_FAIL;

  • Verified Answer

    +1

    Hello,

    The first what comes to my mind - different users can have different default project or stream. So, that will be a stream/project where PcmsQuery() is looking for a fileName.

    Make sure you switch the stream/project context via PcmsSetWsetObj() or execute SCWS command via PcmsExecComman() before using PcmsQuery().

    Other idea, if you are restricting access to Products by user roles, then other users may have no access to items from passed "product" (this restriction is enabled by "DM_PRODUCT_USER Y" in the Dimensions CM Server dm.cfg file).

    It's also not completely clear what exactly "does not work" means, please clarify. Is that PcmsQuery() returning something else than PCMS_OK or any other behavior?

    --
    Kind Regards,
    Alex

    --
    Alex Shevchenko
    Sr Development Manager
    Although I work for OpenText, I am speaking for myself and not for OpenText.
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button.

  • 0 in reply to 

    Hi Alex,

    Good to see you again.

    I use PcmsSetWsetObj to switch my project before execute PcmsQuery and it's work fine now.

    Thank you.

  • 0 in reply to 

    Happy to help!

    --
    Alex Shevchenko
    Sr Development Manager
    Although I work for OpenText, I am speaking for myself and not for OpenText.
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button.