public with sharing class AgencyPersonCmp { @AuraEnabled public Map>> allselectlist{get;set;} @AuraEnabled public String recordId; public AgencyPersonCmp() { } @RemoteAction @AuraEnabled public static AgencyPersonCmp getcontactdata(String recordId){ AgencyPersonCmp li = new AgencyPersonCmp(); li.setalldata(recordId); return li; } public void setalldata(String recordId) { /*** create allselectlist ***/ this.allselectlist = new Map>>(); Map>> alldata = new Map>>(); // プルダウン初期値の空白 List> tmp = new List>(); Map space = new Map(); space.put('label', ''); space.put('value', ''); space.put('selected', 'false'); tmp.add(space); // 代理店担当者 AgencyPerson__c List agency_person_data = LightningUtil.selectAgencyPerson(); System.debug('agency_person_data +++++ ' + agency_person_data.size()); for(Contact var : agency_person_data) { Map om = new Map(); om.put('label', var.Name); om.put('value', var.Id); om.put('selected', 'false'); tmp.add(om); } //if (!String.isBlank(recordId)) { // Agency_Opportunity__c agency_opp = [select Id, Name, Agency_Person__c,Agency_Person__r.Name // from Agency_Opportunity__c where id=:recordId]; // if (!String.isBlank(agency_opp.Agency_Person__c)) { // om.put('label', agency_opp.Agency_Person__r.Name); // om.put('value', agency_opp.Agency_Person__c); // om.put('selected', 'true'); // //tmp.add(om); // } //} System.debug('tmp +++++' + tmp); this.allselectlist.put('AgencyPerson__c', tmp); } //@RemoteAction @AuraEnabled public static String saveagencyOppContact(String recordId, String contactId) { if (String.isBlank(recordId)) { return null; } Agency_Opportunity__c agency_opp = [select Id, Name, Agency_Person__c from Agency_Opportunity__c where id=:recordId]; if (String.isBlank(contactId)) { agency_opp.Agency_Person__c = null; }else{ agency_opp.Agency_Person__c = contactId; } //agency_opp.Agency_Person__c = String.isBlank(contactId) ? null : contactId; //update agency_opp; LightningUtil.updateAgencyOpportunity(agency_opp); return agency_opp.id; } }