Solved

You don't have permission to connect these cards/table records.

  • 7 January 2022
  • 1 reply
  • 396 views

Hello,

I am attempting to create a db record on the GraphQL API. The table (called “Assessments”) has a database connection field called “Candidate”. From the API, as I attempt to set the field values, I add a valid identifier for “Candidate” (candidate exists and the “Candidates” table, the value I’m setting is the title field). IF the same candidate has not been added to another assessment, the mutation is successful. IF the same candidate is already present on another assessment, the mutation fails with the following error:

 

“Error on field "Candidate": Value You don't have permission to connect these cards/table records.”

 

I’d like to stress that THIS QUERY WORKS as long as the Assessments table does not already contain an assessment with the same candidate that I’m attempting to add. So, I don’t personally believe the problem is in the query. I believe the problem might come from my own understanding of how Pipefy works. On the other hand, I definitely expect Pipefy to ALLOW what I’m trying to do because the UI doesn’t give any indication that my Candidate field has to be unique in the table (like we have as an option for other fields).

 

Here’s my code in case it helps:


const _ = require("lodash");
const util = require('util');

const assessment = {
"Candidate": steps.create_candidate_record.$return_value.id,
"Type": steps.card_raw_fields.$return_value["Assessment Type"],
"Focus": steps.card_raw_fields.$return_value["Focus Details"]||"",
};

const fields = Object.keys(assessment).map(key=> ({field_id:_.snakeCase(key), field_value: assessment[key]}));

console.log(fields);

const input = {
table_id: steps.get_tables_involved.$return_value["Assessments"],
fields_attributes: fields
};

const mutation = `
mutation createNewTableRecord{
createTableRecord( input: ${util.inspect(input)} ) {
table_record{id}
}
}`;

const mutationWithDoubleQuotes = _.replace(mutation, new RegExp("'", "g"), '"');

const result = await require("@pipedreamhq/platform").axios(this, {
method: "post",
url: `https://api.pipefy.com/graphql`,
headers: {
Authorization: `Bearer ${auths.pipefy.token}`,
},
data: {query: mutationWithDoubleQuotes }
});

if(result.errors){
throw new Error(result.errors[0].message);
}

return result;

 

I would appreciate anything you can tell me to help me understand how Pipefy works.

 

I would also appreciate any ideas for work-arounds or fixes, since I need to be able to fix my problem.

icon

Best answer by rafaela-marques2 20 January 2022, 18:59

View original

1 reply

Userlevel 1

Hi,

 

Thanks for reaching out! Your table field has probably the “This field must have a unique value” option on. Could you check that, please?

 

In order to do that, you will have to go to your database and click to Edit your field, and then, you will see the screen below:

 

 

 Let us know how it goes, then! :wink: 

Reply