Create and use Object Variablepass 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
Just how much information should you share with a former client?
Would people understand me speaking German all over Europe?
Was Donald Trump at ground zero helping out on 9-11?
Planting Trees in Outer Space
If the Moon were impacted by a suitably sized meteor, how long would it take to impact the Earth?
How can you tell the version of Ubuntu on a system in a .sh (bash) script?
Best Ergonomic Design for a handheld ranged weapon
May a hotel provide accommodation for fewer people than booked?
Why are we moving in circles with a tandem kayak?
How does Asimov's second law deal with contradictory orders from different people?
Applying for mortgage when living together but only one will be on the mortgage
Word for giving preference to the oldest child
Why was the Lobbying Transparency and Accountability Act of 2006 deemed too weak?
Help me, I hate squares!
In the Schrödinger equation, can I have a Hamiltonian without a kinetic term?
How to get Planck length in meters to 6 decimal places
LWC: Removing a class name on scroll
Prepare a user to perform an action before proceeding to the next step
Can you remove a blindfold using the Telekinesis spell?
Can I shorten this filter, that finds disk sizes over 100G?
Word for soundtrack music which is part of the action of the movie
Were there any unmanned expeditions to the moon that returned to Earth prior to Apollo?
Should students have access to past exams or an exam bank?
PCB design using code instead of clicking a mouse?
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 8 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
7 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
7 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
7 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 8 hours ago
Dhanik Lal SahniDhanik Lal Sahni
9573 silver badges11 bronze badges
9573 silver badges11 bronze badges
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
7 hours ago
add a comment |
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
7 hours ago
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
7 hours ago
Thanks! @Dhanik Lal Sahni
– Diego Edargo Pessoa
7 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 7 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