@@ -133,27 +133,32 @@ export default {
133133 return { } ;
134134 } ,
135135 async run ( { $ } ) {
136+ const data = {
137+ Type : this . type ,
138+ Status : this . status ,
139+ Prefix : this . prefix ,
140+ Suffix : this . suffix ,
141+ JobTitle : this . jobTitle ,
142+ Gender : this . gender ,
143+ Birthdate : this . birthdate ,
144+ Employer : this . employer ,
145+ Website : this . website ,
146+ FacebookId : this . facebookId ,
147+ TwitterId : this . twitterId ,
148+ LinkedInId : this . linkedInId ,
149+ PreferredCommunicationChannel : this . preferredCommunicationChannel ,
150+ } ;
151+ if ( this . type === "Individual" ) {
152+ data . FirstName = this . firstName ;
153+ data . LastName = this . lastName ;
154+ data . MiddleName = this . middleName ;
155+ } else {
156+ data . FullName = this . fullName ;
157+ }
158+
136159 const response = await this . bloomerang . createConstituent ( {
137160 $,
138- data : {
139- Type : this . type ,
140- Status : this . status ,
141- FullName : this . fullName ,
142- FirstName : this . firstName ,
143- LastName : this . lastName ,
144- MiddleName : this . middleName ,
145- Prefix : this . prefix ,
146- Suffix : this . suffix ,
147- JobTitle : this . jobTitle ,
148- Gender : this . gender ,
149- Birthdate : this . birthdate ,
150- Employer : this . employer ,
151- Website : this . website ,
152- FacebookId : this . facebookId ,
153- TwitterId : this . twitterId ,
154- LinkedInId : this . linkedInId ,
155- PreferredCommunicationChannel : this . preferredCommunicationChannel ,
156- } ,
161+ data,
157162 } ) ;
158163
159164 $ . export ( "$summary" , `Successfully created constituent with ID ${ response . Id } ` ) ;
0 commit comments