NET LOSS PER SHARE - Antidilutive Securities (Details) - shares
3 Months Ended 6 Months Ended
Jan. 31, 2017
Jan. 31, 2016
Jan. 31, 2017
Jan. 31, 2016
Antidilutive Securities Excluded from Computation of Earnings Per Share [Line Items]        
Antidilutive securities excluded from computation of earnings per share (in shares) 45,416,354 112,953,836 45,416,354 112,953,836
Stock awards        
Antidilutive Securities Excluded from Computation of Earnings Per Share [Line Items]        
Antidilutive securities excluded from computation of earnings per share (in shares) 44,813,334 34,306,230 44,813,334 34,306,230
Common stock subject to repurchase        
Antidilutive Securities Excluded from Computation of Earnings Per Share [Line Items]        
Antidilutive securities excluded from computation of earnings per share (in shares) 551,750 1,504,001 551,750 1,504,001
Common stock warrants        
Antidilutive Securities Excluded from Computation of Earnings Per Share [Line Items]        
Antidilutive securities excluded from computation of earnings per share (in shares) 51,270 0 51,270 0
Convertible preferred stock        
Antidilutive Securities Excluded from Computation of Earnings Per Share [Line Items]        
Antidilutive securities excluded from computation of earnings per share (in shares) 0 76,319,511 0 76,319,511
Convertible preferred stock warrants        
Antidilutive Securities Excluded from Computation of Earnings Per Share [Line Items]        
Antidilutive securities excluded from computation of earnings per share (in shares) 0 824,094 0 824,094