Create and use Object Variablepass actionFunction name of variable to set in controller?Record Create on the...
Using Python in a Bash Script
LWC: Removing a class name on scroll
What do the novel titles of The Expanse series refer to?
Create and use Object Variable
Why does macOS create file mounts for each app?
How to get Planck length in meters to 6 decimal places
Can starter be used as an alternator?
Reducing the time for rolling hash
In the Schrödinger equation, can I have a Hamiltonian without a kinetic term?
Should 2FA be enabled on service accounts?
May a hotel provide accommodation for fewer people than booked?
Gold Battle KoTH
Russian pronunciation of /etc (a directory)
How do discovery writers hibernate?
"Fewer errors means better products" or fewer errors mean better products."
Create two random teams from a list of players
Why don't short runways use ramps for takeoff?
Move arrows along a contour
What force enables us to walk? Friction or normal reaction?
Coworker mumbles to herself when working, how to ask her to stop?
How did Biff return to 2015 from 1955 without a lightning strike?
Can I shorten this filter, that finds disk sizes over 100G?
Can you remove a blindfold using the Telekinesis spell?
Patio gate not at right angle to the house
Create and use Object Variable
pass actionFunction name of variable to set in controller?Record Create on the GoogleDoc object within Visual WorkflowDate arithmetic expressions must use Integer or Long argumentsFill the WhoId and WhatId fields when create an eventLightning, display object fields on a different tabWhat fields and syntax for constructor to create records to add to a list<object>Create related object of certain Record Type on ObjectUsing Flow Designer, I'm trying to iterate through a list of items and put the value of a field in a list separated by a semi-colonHow to use an apex class variable in LWC javascript?Clarification on variable scope rules in Apex
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
How do I create an "Object" variable with two fields inside and assign value to these fields through this "for":
for(RecordTypeInfo info: Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
//Here i would add the value of the variables "info.getRecordTypeId(), info.getName()"
//in Object Name and Id fields.
//myObject.Name = info.getName();
//myObject.Name = info.getRecordTypeId();
}
}
I imagined an object variable like:
Object myObject = {Name, Id}
But I don't think that's how you create it. And if it is not ideal to use variable "Object" what would it be?
apex lightning
New contributor
add a comment |
How do I create an "Object" variable with two fields inside and assign value to these fields through this "for":
for(RecordTypeInfo info: Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
//Here i would add the value of the variables "info.getRecordTypeId(), info.getName()"
//in Object Name and Id fields.
//myObject.Name = info.getName();
//myObject.Name = info.getRecordTypeId();
}
}
I imagined an object variable like:
Object myObject = {Name, Id}
But I don't think that's how you create it. And if it is not ideal to use variable "Object" what would it be?
apex lightning
New contributor
add a comment |
How do I create an "Object" variable with two fields inside and assign value to these fields through this "for":
for(RecordTypeInfo info: Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
//Here i would add the value of the variables "info.getRecordTypeId(), info.getName()"
//in Object Name and Id fields.
//myObject.Name = info.getName();
//myObject.Name = info.getRecordTypeId();
}
}
I imagined an object variable like:
Object myObject = {Name, Id}
But I don't think that's how you create it. And if it is not ideal to use variable "Object" what would it be?
apex lightning
New contributor
How do I create an "Object" variable with two fields inside and assign value to these fields through this "for":
for(RecordTypeInfo info: Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
//Here i would add the value of the variables "info.getRecordTypeId(), info.getName()"
//in Object Name and Id fields.
//myObject.Name = info.getName();
//myObject.Name = info.getRecordTypeId();
}
}
I imagined an object variable like:
Object myObject = {Name, Id}
But I don't think that's how you create it. And if it is not ideal to use variable "Object" what would it be?
apex lightning
apex lightning
New contributor
New contributor
New contributor
asked 9 hours ago
Diego Edargo PessoaDiego Edargo Pessoa
182 bronze badges
182 bronze badges
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can use List<Object>
and List<List<Object>>
to store different object like an array. Here is example
string name='Dhanik';
string id='111';
List<Object> myObject = new List<Object>{name,id};
List<List<Object>> objects=new List<List<Object>>();
objects.add(myObject);
integer num1=1;
myObject = new List<Object>{name,num1};
objects.add(myObject);
system.debug('myObject:' + objects);
system.debug('myObject:' + objects[0]);
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
8 hours ago
add a comment |
It is better to create separate strongly typed Apex class, if you want to use this data in lightning component.
public class RecordTypeInfoObj {
@AuraEnabled
public Id recordTypeId {get;set;}
@AuraEnabled
public String name {get;set;}
public RecordTypeInfoObj(Id recordTypeId, String name) {
this.recordTypeId = recordTypeId;
this.name = name;
}
}
List<RecordTypeInfoObj> recTypeList = new List<RecordTypeInfoObj>();
for(RecordTypeInfo info : Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
recTypeList.add(new RecordTypeInfoObj(info.recordTypeId, info.name));
}
}
In lightning component define the following attribute
<aura:attribute name="listOfRecordTypoInfos" type="RecordTypeInfoObj[]" />
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Diego Edargo Pessoa is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f272027%2fcreate-and-use-object-variable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use List<Object>
and List<List<Object>>
to store different object like an array. Here is example
string name='Dhanik';
string id='111';
List<Object> myObject = new List<Object>{name,id};
List<List<Object>> objects=new List<List<Object>>();
objects.add(myObject);
integer num1=1;
myObject = new List<Object>{name,num1};
objects.add(myObject);
system.debug('myObject:' + objects);
system.debug('myObject:' + objects[0]);
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
8 hours ago
add a comment |
You can use List<Object>
and List<List<Object>>
to store different object like an array. Here is example
string name='Dhanik';
string id='111';
List<Object> myObject = new List<Object>{name,id};
List<List<Object>> objects=new List<List<Object>>();
objects.add(myObject);
integer num1=1;
myObject = new List<Object>{name,num1};
objects.add(myObject);
system.debug('myObject:' + objects);
system.debug('myObject:' + objects[0]);
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
8 hours ago
add a comment |
You can use List<Object>
and List<List<Object>>
to store different object like an array. Here is example
string name='Dhanik';
string id='111';
List<Object> myObject = new List<Object>{name,id};
List<List<Object>> objects=new List<List<Object>>();
objects.add(myObject);
integer num1=1;
myObject = new List<Object>{name,num1};
objects.add(myObject);
system.debug('myObject:' + objects);
system.debug('myObject:' + objects[0]);
You can use List<Object>
and List<List<Object>>
to store different object like an array. Here is example
string name='Dhanik';
string id='111';
List<Object> myObject = new List<Object>{name,id};
List<List<Object>> objects=new List<List<Object>>();
objects.add(myObject);
integer num1=1;
myObject = new List<Object>{name,num1};
objects.add(myObject);
system.debug('myObject:' + objects);
system.debug('myObject:' + objects[0]);
answered 9 hours ago
Dhanik Lal SahniDhanik Lal Sahni
9573 silver badges11 bronze badges
9573 silver badges11 bronze badges
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
8 hours ago
add a comment |
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
8 hours ago
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
8 hours ago
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
8 hours ago
add a comment |
It is better to create separate strongly typed Apex class, if you want to use this data in lightning component.
public class RecordTypeInfoObj {
@AuraEnabled
public Id recordTypeId {get;set;}
@AuraEnabled
public String name {get;set;}
public RecordTypeInfoObj(Id recordTypeId, String name) {
this.recordTypeId = recordTypeId;
this.name = name;
}
}
List<RecordTypeInfoObj> recTypeList = new List<RecordTypeInfoObj>();
for(RecordTypeInfo info : Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
recTypeList.add(new RecordTypeInfoObj(info.recordTypeId, info.name));
}
}
In lightning component define the following attribute
<aura:attribute name="listOfRecordTypoInfos" type="RecordTypeInfoObj[]" />
add a comment |
It is better to create separate strongly typed Apex class, if you want to use this data in lightning component.
public class RecordTypeInfoObj {
@AuraEnabled
public Id recordTypeId {get;set;}
@AuraEnabled
public String name {get;set;}
public RecordTypeInfoObj(Id recordTypeId, String name) {
this.recordTypeId = recordTypeId;
this.name = name;
}
}
List<RecordTypeInfoObj> recTypeList = new List<RecordTypeInfoObj>();
for(RecordTypeInfo info : Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
recTypeList.add(new RecordTypeInfoObj(info.recordTypeId, info.name));
}
}
In lightning component define the following attribute
<aura:attribute name="listOfRecordTypoInfos" type="RecordTypeInfoObj[]" />
add a comment |
It is better to create separate strongly typed Apex class, if you want to use this data in lightning component.
public class RecordTypeInfoObj {
@AuraEnabled
public Id recordTypeId {get;set;}
@AuraEnabled
public String name {get;set;}
public RecordTypeInfoObj(Id recordTypeId, String name) {
this.recordTypeId = recordTypeId;
this.name = name;
}
}
List<RecordTypeInfoObj> recTypeList = new List<RecordTypeInfoObj>();
for(RecordTypeInfo info : Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
recTypeList.add(new RecordTypeInfoObj(info.recordTypeId, info.name));
}
}
In lightning component define the following attribute
<aura:attribute name="listOfRecordTypoInfos" type="RecordTypeInfoObj[]" />
It is better to create separate strongly typed Apex class, if you want to use this data in lightning component.
public class RecordTypeInfoObj {
@AuraEnabled
public Id recordTypeId {get;set;}
@AuraEnabled
public String name {get;set;}
public RecordTypeInfoObj(Id recordTypeId, String name) {
this.recordTypeId = recordTypeId;
this.name = name;
}
}
List<RecordTypeInfoObj> recTypeList = new List<RecordTypeInfoObj>();
for(RecordTypeInfo info : Indicador_Clinico__c.SObjectType.getDescribe().getRecordTypeInfos()) {
if(info.isAvailable()) {
recTypeList.add(new RecordTypeInfoObj(info.recordTypeId, info.name));
}
}
In lightning component define the following attribute
<aura:attribute name="listOfRecordTypoInfos" type="RecordTypeInfoObj[]" />
answered 8 hours ago
BlackCatBlackCat
3471 silver badge11 bronze badges
3471 silver badge11 bronze badges
add a comment |
add a comment |
Diego Edargo Pessoa is a new contributor. Be nice, and check out our Code of Conduct.
Diego Edargo Pessoa is a new contributor. Be nice, and check out our Code of Conduct.
Diego Edargo Pessoa is a new contributor. Be nice, and check out our Code of Conduct.
Diego Edargo Pessoa is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f272027%2fcreate-and-use-object-variable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown