whats the number of times the letter > appears in:
q: how to save related case accountnumber field on task using process builder i need to create a field in task where the value should be the task related case related account number.


i want task.whatid.account.accountnumber something like this

a: since the what field is a polymorphic lookup, it is not very flexible to fetch the data from the parent object.
if you are still willing to try a trigger, here is a sample code.
trigger updatecaseaccount on task (before insert, before update) {
    list<id> lstcaseids = new list<id>();

    for (task task : trigger.new){ 
        if(task.whatid != null){
            lstcaseids.add(task.whatid);
        }
    }

    map<id, case> mapcases = new map<id, case>([select id, account.accountnumber from case where id =: lstcaseids]);

    for (task task : trigger.new){ 
        if(task.whatid != null){
            task.case_account__c = mapcases.get(task.whatid).account.accountnumber;
        }
    } 
}

i have created the field case_account__c as a text field, which will be populated with accountnumber using the account related to the case.

a: try this trigger. 
trigger tasktrigger on task (before insert, before update) {

    set<id> caseids = new set<id>();
    for (task t : trigger.new) { 
        if(t.whatid != null && string.valueof(t.whatid).startwith(500)) {
            caseids.add(t.whatid);
        }
    }

    map<id, case> casemap = new map<id, case>([select id, accountid, account.accountnumber from case where id in :caseids]);

    for (task t : trigger.new) { 
        if(t.whatid != null) {
            t.account_number__c = casemap.get(t.whatid).account.accountnumber;
        }
    } 
}

you can also go for process builder with flows.

user
The given text has 8 ">"s.
assistant