Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
How can I change account data inside of account_list when working with the Q2TectonServerRequestHandler?

I am building an extension where I want to update the account label inside of account_list. The update works inside of the route I perform the update in, however once I change routes the data is gone. I thought that the next step would be to make an update directly to the database, but I cannot find in the documentation where this exact issue is addressed.

Below is an example of the code I am using to update the account label. This is just the relevant pieces of the route, not the full code.

				new_account_label = self.form_fields['new_account_label']
        account_number = int(self.form_fields['account_id'])
				count = 0
				
				for item in self.account_list:
            if item.host_acct_id == account_number:
                item.acct_label = new_account_label
                accounts_to_refresh.append(item.acct_number_internal)
                break
            count += 1
						
				template = self.get_template('nameChange.html.jinja2', {
                'new_account_label': self.account_list.accounts[count].acct_label,
                'account_number': account_number
            }
        )		
						

In the code, I used 'new_account_label': self.account_list.accounts[count].acct_label instead of 'new_account_label': new_account_label to make sure that the account label was updated, and it was but only in the route this code exists in. In all other routes the change does not apply.

Where can I find information on this particular issue in the database or what is the right way to approach this problem? Thank you.

Votes Newest

Answers


Hello Ethan,

For the property to stick you would have to update the database. It isn't very common to update this so you would have to update the property via: https://docs.q2developer.com/api_references/q2_sdk/db/db_objects/user_account_attribute_data.html

Just curious why are you trying to update the label? Updating the account nickname is far more common via: https://docs.q2developer.com/api_references/hq_api/q2_api/ChangeEndUserAccountNickname.html

Thank you,
Trey Teter

Posted 4 years ago
Trey Teter
124 × 2 Administrator
0

Thank you for the advice. Using account nickname was what I was meaning to do, and that API worked for what I needed.

— Ethan Pittman   4 years ago