Powerbuilder - If value are null then account id on db table will change to 0 - powerbuilder

currently i have a column profile.acct_no on datawindow, where user select a customer account from the popup listing. Now the problem is, user can't clear the previous already selected account, it always shows the selected account, unless you select another account. User can clear column box and click saved, but when they go back to view it, the account shows again.
Now from the database, all the selected account id are register into a table call interco.acct_id, what i need to do is, code the event itemchanged where if the column profile.acct_no are null, then it will clear the account id from table interco.acct_id to 0.
What i already do is code the non-visual object business rule for the datawindow, at event ue_itemchanged_acct_no return none:
string s_value
s_value = invo_tm.uf_getcolumnstring( istr_vldmsg.l_row, istr_vldmsg.s_column )
if isnull( s_value ) or trim( s_value ) = '' then
invo_tm.uf_setcolumn( istr_vldmsg.l_row, is_dirulealias + '.acct_id ', 0 )
end if
Problem is, the account still shows and the id won't change to 0. Can anyone please help and advice? Much appreciated. Thanks.

I would check a few things.
Check the update properties for your datawindow. interco.acct_id should be updateable.
If interco and profile are both in the same datawindow, you will need to do some fancy footwork to update both tables. Check out this great article by Rick Schultz about PFC DataWindow Multi-Table Update Service here https://pbbraindump.wordpress.com/2008/07/02/pfc-datawindow-multi-table-update-service/
Also, if interco.acct_id or profile.acct_no are unique in the database then you will be unable to successfully change several records to 0.


SalesForce: How to automatically update a record after a Formula (Text) field is populated

I am trying to figure out how to automatically update a contact record after a Formula (Text) field is updated from another object. The end goal is generate a outbound message when one field contact field is updated. Here is the work flow:
Within an Origination I have a field called Project Status which is picklist containing the following status : Active, Dormant, and Terminated. The Organization Object also has a project name field.
Within the Contact record I have a fields that link a contact record to an organization: Name of the Project and Project Status. More than one Contact record can be listed to a single Organization.
What I am trying to do is to change the Project Status on the Organization record and have the associated contact records be updated. Upton this change, I would like to generate an Outbound Message.
My working theory is that once a Contact is is updated via a Formula (Text)look up, the record is not really saved (updated).
Any ideas would be extremely helpful!
Yes, formula records don't really update their records, they're calculated at runtime when you're viewing it. You can index them (contact SF support) but not track field history for example.
Also - because it's an update of Organization__c, not Contact - nothing really fires on Contact. No Contact workflows will run, no way to use PRIORVALUE() function...
You need something that cascades down on update of parent object & "touches" all Contacts (doesn't matter whether will it be an update without changing any fields or will you have a helper field... or convert the formula to editable picklist). Can be a after update trigger on Organization__c, can be a Process Builder if that's your game. Probably PB is better, declarative, easier to change... I didn't test it but something similar to this could be a nice start (or use the Flash-based Flow designer, there's a way to update related records in there too?)
Here is what I did. Please let me know if you have any questions on my steps:

Account checkbox marks true when at least one Contact's checkbox is true

We currently have a custom checkbox field in contacts that we have set to true if they are the best person to call for that particular account. I want to create a checkbox field in accounts that will automatically mark true if it contains a contact with that particular checkbox marked true.
Essentially, I want an account checkbox called "Contains a best contact" that marks true when at least one of its contacts has the "Best person to contact" checkbox marked true.
In general, your use case would be an example of a Roll-Up field between a Master and Detail objects. However, you cannot make the Contact the detail to an Master object - let alone the Account.
You have a couple of options, but they aren't great.
You would need to create an Apex class to do the query of all the child Contact objects and update the Account accordingly. This might be best to do this through an Update Trigger on the Contact objects to update the parent Account. If the Contact record meets the criteria, then submit an update to the Account object using the Account ID in the Contact's Account field.
The warning here is that this is an extra DML statement on Contact updates. If you do any bulk activity on Contacts this could exceed DML limits. However, if you tailor the trigger correctly you may be able to limit how and when action is actually taken in the trigger. The best would be to only enter the update code block if the Contact has an Account and the "Best person to contact" check box is being changed from "False" to "True" (you look at the old and new values in the trigger to determine that this change is occurring).
If you prefer a declarative solution without the use of triggers you could use the process builder along with flows in the process builder based on Contact you check for the checkbox being checked and ischanged so you dont process records that have already been processed and for the action kick off a flow passing in the AccountId as in input param. The flow would query accounts that have the Id passed in with the checkbox unchecked and perform an update or quick update to check the box.
You would also have to do the inverse process builder (different step in the same process builder or a different process all together doesn't really matter) where you check if the check box is not checked and ischanged and kick off a different flow (or same flow if you pass the checkbox state as an input parameter). This other flow would search for accounts that have the checkbox checked by the Id, if it is found you can then search for contacts with the flag and if none are found update the account to uncheck the checkbox.
But to update existing data you would need some code, which might need to be batched depending on how many records exist with he Flag set on Contact.
If you disable the ischanged option on the process builder process you can use the process builder and flows to update your data by doing something like:
update [SELECT Id FROM Contact WHERE Flag__c = true];
which will trigger the flow. Otherwise you need something like
Set<Id> accountIds = new Set<Id>();
List<Account> accToUpdate = new List<Account>();
for(Contact c : [SELECT AccountId FROM Contact WHERE Flag__c = true]){
accToUpdate.add(new Account(Id = c.AccountId, Account_Flag__c = true));
update accToUpdate;

validate visualforce page with multiple lookup fields

I have created a visualforce that allows a user to dynamically add rows to insert many child records related to a master record.
Each new rows contains 3 lookup fields (Account, Contact and User). The record is a custom object called "Participant". A participant can either be an "Account", "Contact" or "User".
I'm trying to create some validation that would prevent the user from choosing more than one lookup selection. For example, if the user select an account, then I don't want them to select a contact or user. If they select a contact, I don't want them to be able to select an account or user. If they select user, then I don't want them to be able to select an account or contact. I thought about a validation rule, but preferably, I'd like to validate the form before the record(s) are saved. Also, there is a use case where the user selects a contact and when they save, I have a trigger that fires and looks up the related account and populates the account look-up field automatically for them for that record (row).
I've been struggling with how to provide a good user experience to validate this use case.
What would be the best approach to provide the validation?
Any design approaches would be appreciated.
I think that the simplest way is a hiding 2 other fields for user after the choosing value on a first field, e.g. User choose value into Account field, after that you run js code into your page and hide the fields Contact & User. I think it's enough.
The another way is validate it on the fly, the trigger is same as on first case, but for now you look into 2 another fields and if one of their has a filled value you show error message on page and reset the entered value to null.

PHPMyAdmin creating relationship beetween pages does not wor

Hi I am trying to create a relationship beetween two database tables in phpMyAdmin:
user_id , user_name , user_pwd
profile_id , profile_name , profile_email , profile address , user_id
After I click the create relation button I am asked to create a referenced key and I click on the USERS table user_id.
After that I am asked to set a foreign id and I select the profile user_id.
The next thing a box appears with two buttons and a label that says Create Relation and the buttons OK and Cancel.I click on the OK button but nothing happens.I have tryed doing this a dozen times but with no succes.
What is wrong?
The information surrounding the question is a bit weak, what storage engine is used etc. But I had a similar problem just now and the reason for it not working was because the referring key did not have an index. Usually this is handled automatically (I think phpMyAdmin is responsible for this but I do not know) but in some cases one will manually have to add the index to make it work.

Compare two views in salesforce

I am looking for a way to compare two views in salesforce. I want to create a visual force page that lets a user select two views associated with the Account object and show all the accounts that appear on both views.
I am struggling pretty hard here, I can't figure out how to get the results from the views, but I am hoping there is a way to get all accounts that match the filters for each view.
Here is my SOQL query:
Select Id, Name, Owner.Name FROM Account WHERE
Id IN ( SELECT AccountId FROM Opportunity WHERE RecordTypeId = :RecordType1ID AND StageName IN :StageOneList )
AND Id IN ( SELECT AccountId FROM Opportunity WHERE RecordTypeId = :RecordType2ID AND StageName IN :StageTwoList )
This is the basis of the VF page I have made so far. It is possible to filter the Account with Account Owner and a drop down list from province. The idea is, many people in the organization have already created views with the accounts filtered as they need it. Instead of including every possible account field as a filter, I would like a drop down list of the active users views associated with Account, and then they can select Opportunity 1 and Opportunity 2 and have a list of Accounts matching.
I assume you mean views as in the available views in the dropdown box on a standard tab for an object? If so I don't believe you can query the results from them directly although you can query the Account object using a SOQL statement where you provide the filter.
My suggestion would be either create a set VF page that has 2 drop downs to switch the SOQL query that is used to return the list of accounts being displayed (would mean you have a set of predetermined views and updates to them require code updates) or give more details of your use case and we may be able to provide other suggestions.
It sounds like you just need to compare the results of the filters here. My suggestion would be that you're really trying to do something that should be done with reports, not with views.
Put two enhancedList components on the page.