• Rajaganagavel
  • NEWBIE
  • 15 Points
  • Member since 2018
  • Salesforce Developer Beginner

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hi  Folks, 

I have permission set included in my managed package but during the installation of my package in other org, it is not showing in the package components.
I created this permission set with Salesforce Platform license and included.
My package component -  Permission set
User-added image

Package installation page in other org

User-added imageUser-added imageAs you can see the package installation page, there is no component called permission set. 
Please clarify this issue.


 

Hello Guys, 

I'm just trying to retrieve the data based on the below JSON format in workbench.
Expected JSON in workbench:
{
"Master":"Product",
"Fields":["ProductName,Price"],
"Data": [["Product A","10"],["Product B","20"]]
}

I have custom object called Product_C with the fields ProductName, Price so in that I'm going to retrieve the records as data in the above format. I have rest API class as below.

@RestResource(urlMapping = '/ProductApi/*')
global with sharing class ProductClass {
 @HttpGet
 global static String  getProduct() {
  List < Product__c > products = [SELECT Product_Name__c, Price__c FROM Product__c LIMIT 10];
  JSONGenerator generator = JSON.createGenerator(true);
  generator.writeStartObject();
  generator.writeFieldName('Master');
  generator.writeString('Product');
  generator.writeFieldName('Fields');
  generator.writeStartArray();
  generator.writeString('Name');
  generator.writeString('Price');
  generator.writeEndArray();
  generator.writeFieldName('Data');
  generator.writeStartArray();
  for (Product__c P: products) {
   generator.writeStartArray();
   generator.writeString(P.Product_Name__c);
   generator.writeNumber(P.Price__c);
   generator.writeEndArray();
  }
  generator.writeEndArray();
  generator.writeEndObject();
String jsonString = generator.getAsString();
return jsonString;
 } 
}


By the above class, I'm getting the data as below format in workbench.

WorkBench Raw Response:

"{\n \"Master\" : \"Product\",\n \"Fields\" : [ \"Name\", \"Price\" ],\n \"Data\" : [ [ \"Crocin\", 40.00 ], [ \"Tetanus\", 90.00 ], [ \"Eucalyptus Oil\", 27.00 ], [ \"Axe Oil\", 69.00 ], [ \"Dola 650\", 89.00 ], [ \"Anaestheia\", 43.00 ], [ \"Inhaler\", 105.00 ], [ \"Pain relief oil1\", 40.00 ], [ \"Pain relief oil2\", 25.00 ], [ \"Pain relief oil3\", 15.00 ] ]\n}"

So help me how the get expected JSON based on my requirement.

Expected JSON in workbench:
{
"Master":"Product",
"Fields":["ProductName,Price"],
"Data": [["Product A","10"],["Product B","20"]]
}

Whereas when executing in the anonymous window, I had the result
Anonymous window result

Hi Folks,

I have a custom object called  Jobs with two fields namely Job_Name, Vacancies.

I want to create an apex rest class with get method and it should give the data in json format in workbench as below

{
"Master":"Jobs",
"Fields":["JobName,Vacancies"],
"Data": [["HR","10"],["Manager","20"]]
}

Please help me how to achieve using which json methods
Hi Guys,

In my ORG, I have two custom objects named as follows.

Here Warehouse is Parent Object and Product is Child object.

Also, master-detail relation ship has created with Product_Warehouse_Location field in Product object

Custom Objects

But I'm trying to retrive the record using child to parent  relationship SOQL queries between the objects

SOQL Query
I'm getting  the following error in Query editor window.

Product_Warehouse_Location__c, Product_Name__c ,Warehouse__r.Name FROM Product__c
                                                ^
ERROR at Row:1:Column:65
Didn't understand relationship 'Warehouse__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.



Please someone help me on this. Help to identify whats wrong with my query.

Custom Object Parent API Name : Warehouse__c
Fields:
Name
Warehouse_Name__c
Warehouse_Location__c

Custom Obejct Child API Name : Product__c
Fields:
Name
Product_Name__c
Product_Warehouse_Location__c ---Master-Detail(Warehouse)



 

Hello Guys, 

I'm just trying to retrieve the data based on the below JSON format in workbench.
Expected JSON in workbench:
{
"Master":"Product",
"Fields":["ProductName,Price"],
"Data": [["Product A","10"],["Product B","20"]]
}

I have custom object called Product_C with the fields ProductName, Price so in that I'm going to retrieve the records as data in the above format. I have rest API class as below.

@RestResource(urlMapping = '/ProductApi/*')
global with sharing class ProductClass {
 @HttpGet
 global static String  getProduct() {
  List < Product__c > products = [SELECT Product_Name__c, Price__c FROM Product__c LIMIT 10];
  JSONGenerator generator = JSON.createGenerator(true);
  generator.writeStartObject();
  generator.writeFieldName('Master');
  generator.writeString('Product');
  generator.writeFieldName('Fields');
  generator.writeStartArray();
  generator.writeString('Name');
  generator.writeString('Price');
  generator.writeEndArray();
  generator.writeFieldName('Data');
  generator.writeStartArray();
  for (Product__c P: products) {
   generator.writeStartArray();
   generator.writeString(P.Product_Name__c);
   generator.writeNumber(P.Price__c);
   generator.writeEndArray();
  }
  generator.writeEndArray();
  generator.writeEndObject();
String jsonString = generator.getAsString();
return jsonString;
 } 
}


By the above class, I'm getting the data as below format in workbench.

WorkBench Raw Response:

"{\n \"Master\" : \"Product\",\n \"Fields\" : [ \"Name\", \"Price\" ],\n \"Data\" : [ [ \"Crocin\", 40.00 ], [ \"Tetanus\", 90.00 ], [ \"Eucalyptus Oil\", 27.00 ], [ \"Axe Oil\", 69.00 ], [ \"Dola 650\", 89.00 ], [ \"Anaestheia\", 43.00 ], [ \"Inhaler\", 105.00 ], [ \"Pain relief oil1\", 40.00 ], [ \"Pain relief oil2\", 25.00 ], [ \"Pain relief oil3\", 15.00 ] ]\n}"

So help me how the get expected JSON based on my requirement.

Expected JSON in workbench:
{
"Master":"Product",
"Fields":["ProductName,Price"],
"Data": [["Product A","10"],["Product B","20"]]
}

Whereas when executing in the anonymous window, I had the result
Anonymous window result

Hi Folks,

I have a custom object called  Jobs with two fields namely Job_Name, Vacancies.

I want to create an apex rest class with get method and it should give the data in json format in workbench as below

{
"Master":"Jobs",
"Fields":["JobName,Vacancies"],
"Data": [["HR","10"],["Manager","20"]]
}

Please help me how to achieve using which json methods
Hi Guys,

In my ORG, I have two custom objects named as follows.

Here Warehouse is Parent Object and Product is Child object.

Also, master-detail relation ship has created with Product_Warehouse_Location field in Product object

Custom Objects

But I'm trying to retrive the record using child to parent  relationship SOQL queries between the objects

SOQL Query
I'm getting  the following error in Query editor window.

Product_Warehouse_Location__c, Product_Name__c ,Warehouse__r.Name FROM Product__c
                                                ^
ERROR at Row:1:Column:65
Didn't understand relationship 'Warehouse__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.



Please someone help me on this. Help to identify whats wrong with my query.

Custom Object Parent API Name : Warehouse__c
Fields:
Name
Warehouse_Name__c
Warehouse_Location__c

Custom Obejct Child API Name : Product__c
Fields:
Name
Product_Name__c
Product_Warehouse_Location__c ---Master-Detail(Warehouse)